Shared memory python between two separate shell-launched processes

Philip osvenskan at
Fri Feb 11 17:15:03 CET 2011

On Feb 11, 6:27 am, Adam Skutt <ask... at> wrote:
> On Feb 10, 9:30 am, "Charles Fox (Sheffield)" <charles.... at>
> wrote:
> > But when I look at posix_ipc and POSH it looks like you have to fork
> > the second process from the first one, rather than access the shared
> > memory though a key ID as in standard C unix shared memory.  Am I
> > missing something?   Are there any other ways to do this?
> I don't see what would have given you that impression at all, at least
> with posix_ipc.  It's a straight wrapper on the POSIX shared memory
> functions, which can be used across processes when used correctly.
> Even if for some reason that implementation lacks the right stuff,
> there's always SysV IPC.
[some stuff snipped]
> Also, just FYI, there is no such thing as "standard C unix shared
> memory".  There are at least three different relatively widely-
> supported techniques: SysV, (anonymous) mmap, and POSIX Realtime
> Shared Memory (which normally involves mmap).  All three are
> standardized by the Open Group, and none of the three are implemented
> with perfect consistency across Unicies.

Adam is 100% correct. posix_ipc doesn't require fork.

@the OP: Charles, since you refer to "standard" shared memory as being
referred to by a key, it sounds like you're thinking of SysV shared
memory. POSIX IPC objects are referred to by a string that looks like
a filename, e.g. "/my_shared_memory".

Note that there's a module called sysv_ipc which is a close cousin of
posix_ipc. I'm the author of both. IMO POSIX is easier to use.


More information about the Python-list mailing list