Light (general) Inter-Process Mutex/Wait/Notify Synchronization?

John Nagle nagle at animats.com
Tue Apr 28 12:46:04 EDT 2009


Gunter Henriksen wrote:
>> If you don't want to use a 3rd party module you could
>> use the multiprocessing module
> 
> That is definitely good for when I have a tree of
> processes which are all Python applications.  I use
> it for that.  But I am looking for something where
> the Python application can interact conveniently
> with an arbitrary external application.  Using a
> socket/pipe and shared memory is convenient, but
> not feasible when system call overhead matters.

     Linux doesn't do interprocess communication very well.
The options are pipes (clunky), sockets (not too bad, but
excessive overhead), System V IPC (nobody uses
that) and shared memory (unsafe).

     If you want to see IPC right, what you really need is
the QNX microkernel, and its messaging system.  I've pumped
uncompressed video through the QNX messaging system and had
only 2% of the CPU devoted to message overhead.  The basic
primitives are MsgSend, MsgReceive, and MsgReply, which do
about what you'd expect and do it very fast.  Linux lacks
this.

    If you're using CPython, don't worry about socket overhead.
CPython is so slow you'll never notice it.

			John Nagle



More information about the Python-list mailing list