Standard IPC for Python?
philip at semanchuk.com
Tue Jan 13 17:39:23 CET 2009
On Jan 13, 2009, at 11:25 AM, Laszlo Nagy wrote:
> I would like to develop some module for Python for IPC. Socket
> programming howto recommends that for local communication, and I
> personally experienced problems with TCP (see my previous post:
> "Slow network").
> I was looking for semaphores and shared memory, but it is not in the
> standard lib. I was also thinking about unix domain sockets, but it
> is not available under windows.
> I was looking for non-standard modules as well, but only found a few
> references with insufficient information. For example:
> The question is: what is the standard way to implement fast and
> portable IPC with Python? Are there tools in the standard lib that
> can do this?
They're not in the standard lib, but I have 3 modules for Python IPC.
They're all Unix-only.
posix_ipc gives you semaphores, shared memory and messages queues:
sysv_ipc gives you semaphores and shared memory:
shm also gives access to SysV semaphores and shared memory:
The only reason to use shm over the sysv_ipc module is that shm
supports versions of Python < 2.5. I'm not developing shm any further,
so avoid using it if possible.
Here's an overview that compares the three:
The overview of the overview is that posix_ipc is the one to use if
you can because it is the simplest. sysv_ipc is more broadly supported
but is more complicated for programmer (me) and user (you) alike.
Bugs reports are of course welcome.
More information about the Python-list