Re: [sv-ec] killing a process blocked on a semaphore get

From: Steven Sharp <sharp_at_.....>
Date: Tue Jun 12 2007 - 18:11:27 PDT
>The LRM is silent on the behavior but I think that the key
>assignment should be "atomic" in the sense that either
>3 keys go or none do.

Yes, we assumed the same thing.

There is something else affected by whether the consumption is
atomic, or whether the process consumes the keys as they become
available, until it gets enough.

The description of try_get() appears to allow a process to bypass
the normal FIFO order and grab keys that were part of a request
from a prior process.  But if the keys are consumed as they are
added, then they might not be available to a later try_get().

BTW, killing a process blocked on a semaphore get() is clearly
dangerous.  If it is killed at the same time that it gets the
keys, then it can be nondeterministic whether it got the keys
before dying.  So it is nondeterministic whether the keys have
been permanently lost or are still present.  Anyone doing this
needs to either be very careful about the timing to avoid such
race conditions, or throw the semaphore away after killing anything
waiting on it, and not continue using it.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Jun 12 18:11:50 2007

This archive was generated by hypermail 2.1.8 : Tue Jun 12 2007 - 18:12:07 PDT