> Bruce Momjian wrote:
> >
> > > It seems to me that we already have a small sleep in place. After all, in
> > > order to acquite a lock, the shared memory area has to be accessed. So,
> > > the contenders for a lock both have to go through a spin lock. So, if we
> > > have the two "stuck" processes as in Tom's example, one will win at
> > > acquiring the spin lock and the other will have to wait. So, they become
> > > desynchronized, regardless of how many CPUs or what memory architecture
> > > you have.
> >
> > I see your point now, that they can't synchronize because they have to
> > go through the same semaphore and therefore get out of sync. Do they
> > get out of sync enough for one to get the lock while the other is not
> > holding it, or do the locks actually keep them in sync? I don't know
> > the answer.
> >
>
> That is a good point. With the current random sleeps it helps breaking
> the
> lockstep of the two processes, but when it is changed to a queue the
> random
> sleeps won't be there anymore.
Also most systems can't sleep less than one clock tick, 10ms, meaning
the sleeps aren't very random.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026