[Info-vax] counting-lock ?

Pierre pierre.bru at gmail.com
Mon Oct 26 10:52:41 EDT 2009


On Oct 26, 2:35 pm, JON... at ecr6.ohio-state.edu (David Jones) wrote:
> In message <8eac02f9-697f-4036-b91a-5cad24f7c... at h2g2000vbd.googlegroups.com>
>
>  Pierre <pierre.... at gmail.com> writes:
> >this looks interesting but if the process holding lock B dies before
> >converting it to CW, the process waiting for B may wrongly exit on the
> >timeout (or wait forever if no timeout is used). the same may happen
> >if (unfortunately) a process holding a lock on B exits between
> >counting and the conversion of lock on B to PW.
>
> First of all, a process dieing while holding a lock should be a rare exception
> and the cause investigated and fixed.  You don't get a wait condition until
> multiple (e.g. 5) processes hold the lock,  If a lock holder dies, the wait
> will still be satisfied by the next process that releases the lock.  If someone
> kills the process prior to converting lock B to PW, lock A goes also so the
> next process needing the lock isn't blocked from seeing the correct current
> grant count.

first, I absolutely agree that one *must* investigate the cause(s)
making a process expectingly die but unfortunately this sometimes
happens. the process may also die because of a stop/id...

anyway, by

> > [...] the same may happen
> > if (unfortunately) a process holding a lock on B exits between
> > counting and the conversion of lock on B to PW.

I don't mean "if the requesting process dies" but "if one of the
(e.g.) 5 processes already legitimately holding the resource dies"
between test (n<=5) in step 4 and step 5. as those processes dequeued
lock on A in their own step 4, they can no longer auto-release it
while dying.

> If a lock holder dies, the wait
> will still be satisfied by the next process that releases the lock.

yes. but this may take awhile, maybe longer than the requested
timeout. and if I create a library, I want the same procedure to work
for any n, even n=1, in which case there will not be any next process
to release their lock :(



More information about the Info-vax mailing list