Re: shmget vs. shm_open

From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 11/18/05


Date: Fri, 18 Nov 2005 18:09:56 +0100

bill pursell wrote:
>
> Can anyone point me to a comparison of using sysVr4 shmget() calls
> versus Posix shm_open()? Is there a reason (other than wanting to
> conform to one standard vs. the other) to choose one over the other?
> If my app is only going to be running on Linux, does it matter which
> style of shared memory I choose to use?

I think Posix shared memory is more convenient. The API
is essentially the same as with memory mapped files, and
the semantics are also the same. Posix shared memory
also allows you to easilly map a part of a shared memory
segment, something which SysV shared memory does not.
And AFAIK only Posix shared memory have a clear semantics
in case you delete a shared memory segment while it is
still mapped. This is something one needs to do in order
to avoid leaks in case of unexpected termination.

-- 
Kasper Dupont
Note to self: Don't try to allocate
256000 pages with GFP_KERNEL on x86.


Relevant Pages

  • Re: new driver development
    ... flavors of shared memory are supported by a single driver. ... SVID and POSIX shared memory are quite different. ... We support timespec where it exists. ...
    (comp.protocols.time.ntp)
  • Re: "System V IPC is a botch?"
    ... > immediately used to access a message queue, semaphore set, or shared memory ... same folks who gave us the /proc filesystem. ... By "POSIX shared memory" I was referring specifically to mmap, ... It would be nice if both IPCs allowed you to associate an FD with the ...
    (comp.unix.programmer)
  • Re: missing documentation for POSIX shared memory (shm_open) in HP-UX 11i
    ... |I've written a program on HP-UX 11i that doesn't work. ... |fine in Linux however. ... |The problem seems to be the attempt to try to create POSIX shared memory using ... |Do I have to be root to create POSIX shared memory? ...
    (comp.sys.hp.hpux)
  • Re: missing documentation for POSIX shared memory (shm_open) in HP-UX 11i
    ... Mike Stroyan writes: ... > |fine in Linux however. ... > |The problem seems to be the attempt to try to create POSIX shared memory using ... > |Do I have to be root to create POSIX shared memory? ...
    (comp.sys.hp.hpux)
  • operating system limit was reached
    ... 17:36:56 Requested shared memory segment size rounded from 116736KB to ... 08:56:16 Dynamically allocated new virtual shared memory segment (size ... allocate shared memory because an operating system limit was reached ...
    (comp.databases.informix)