Standard IPC for Python?

Philip Semanchuk philip at semanchuk.com
Tue Jan 13 19:09:09 CET 2009


On Jan 13, 2009, at 12:40 PM, Laszlo Nagy wrote:

>
>> 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.
> Hmm, we are using FreeBSD, Ubuntu and Windows. Unfortunately
>
> - posix_ipc is broken under FreeBSD

A clarification: the module posix_ipc is *not* broken. It exposes  
FreeBSD's implementation of POSIX IPC which has broken semaphores  
(based on my experiments, anyway). The practical result for you is the  
same but the difference is very important to me as the module author.  
Fixing the posix_ipc module is under my control, fixing FreeBSD's  
POSIX IPC is not.

> - sysv_ipc does not support message queues at all

That's true, but in your original email you said you were looking for  
"semaphores and shared memory". There was no mention of message queues.

I'm working on message queue support, but the Sys V IPC API is a  
headache and takes longer to code against than the POSIX API.


> - shm is not maintained

SHM *is* maintained. As I said in my first email and as it says on the  
Web page, I'm not developing it any further. No further development !=  
unmaintained.

Also, it offers only a subset of the features in sysv_ipc, so its  
status is not of great concern unless you're using Python < 2.5.


> - windows is not supported by any of these modules

Windows uses a different API, but I think there are some packages that  
can make Windows look like some flavor of Unix. For instance, Cygwin  
seems to expose some relevant APIs like sem_open(), sem_post(), etc:
http://cygwin.com/cygwin-api/compatibility.html#std-susv3

It might be that posix_ipc would work with this package with just a  
little tweaking. I have no idea. As I said on the posix_ipc page, if  
anyone wants to tackle this one and send me bug reports, please do!


> It is so interesting that there is no standard implementation for  
> IPC in Python. I would think it is a very common task for  
> programmers. I might find myself writting a new IPC module that  
> works under Windows as well.

Feel free to reinvent the wheel. Or, you could pitch in and help with  
what's already out there.


bye
Philip







More information about the Python-list mailing list