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:

http://code.activestate.com/recipes/519626/

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:
http://semanchuk.com/philip/posix_ipc/

sysv_ipc gives you semaphores and shared memory:
http://semanchuk.com/philip/sysv_ipc/

shm also gives access to SysV semaphores and shared memory:
http://nikitathespider.com/python/shm/

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:
http://semanchuk.com/philip/PythonIpc/


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.


Enjoy!

Philip


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to