[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another Semaphore question.



On 04-May-2001 Stanislav Malyshev a.k.a Frodo wrote:
>>> This is not a PROBLEM but a FEATURE. All Sys-V IPC (semaphores,
>>> message queues, shared memory) outlive their creators.
> 
> Wrong. Shared memory can be pre-deleted, so that it is removed when last
> process is detached. Just like files.

True, but they can only be used by an already attached processes just like
open files that are unlinked (although they appear in ipcs(1), a shmget(2)
fails with 'identifier removed' error).

Actually, this was very interesting remark. Since the API's of the 3 Sys-V
IPC mechanisms is so similar I haven't noticed (until now) that shared
memory has different sematics (because it has shmdt() <==> close(), while
message queues and semaphores don't have an equivalent call).

Thanks for the enlightenment...

BTW: we both agree that for *mutual exclusion* there are better means than
     semaphores.

------------------------------------------------
Oron Peled                             Voice/Fax: +972-4-8228492
oron@actcom.co.il                  http://www.actcom.co.il/~oron

The best way to accelerate a Windows box...
                   ...is at 9.8 meters per second per second.


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il