Re: object references/memory access
- From: John Nagle <nagle@xxxxxxxxxxx>
- Date: Tue, 03 Jul 2007 11:07:03 -0700
Steve Holden wrote:
Karthik Gurusamy wrote:
On Jul 1, 12:38 pm, dlomsak <dlom...@xxxxxxxxx> wrote:
[...]
I have found the stop-and-go between two processes on the same machine
leads to very poor throughput. By stop-and-go, I mean the producer and
consumer are constantly getting on and off of the CPU since the pipe
gets full (or empty for consumer). Note that a producer can't run at
its top speed as the scheduler will pull it out since it's output pipe
got filled up.
This is in fact true, but the overheads of CPython are so large
that you don't usually see it. If message passing in CPython is slow,
it's usually because the marshalling cost is too high. As I mentioned
previously, try "pack" instead of "pickle" or "repr" if you control
the interface on both ends of the connection.
I've used QNX, the message-passing real time operating system,
extensively. QNX has the proper mechanisms to handle interprocess
communication efficiently; we could pipe uncompressed video through
the message passing system and only use 3% of the CPU per stream.
QNX deals with the "stop and go" problem properly; interprocess
communication via MsgSend and MsgReceive works more like a subroutine
call than a queued I/O operation. In the normal case, you pay for
a byte copy and a context switch for a message pass, but it's
not necessary to take a trip through the scheduler.
Not many operating systems get this right. Minix 3 does,
and there are infrequently used facilities in NT that almost do.
But pipes, sockets, and System V IPC as in Linux all take you through
the scheduler extra times. This is a killer if there's another compute
bound process running; on each message pass you lose your turn for
the CPU.
(There have been worse operating systems. The classic MacOS allows
you one (1) message pass per clock tick, or 60 messages per second.)
John Nagle
.
- References:
- object references/memory access
- From: dlomsak
- Re: object references/memory access
- From: "Martin v. Löwis"
- Re: object references/memory access
- From: Paul Rubin
- Re: object references/memory access
- From: "Martin v. Löwis"
- Re: object references/memory access
- From: Paul Rubin
- Re: object references/memory access
- From: dlomsak
- Re: object references/memory access
- From: Karthik Gurusamy
- Re: object references/memory access
- From: Steve Holden
- object references/memory access
- Prev by Date: Re: Programming Idiomatic Code
- Next by Date: Re: python 3.0 or 3000 ....is it worth waiting??? Newbie Question
- Previous by thread: Re: object references/memory access
- Next by thread: Problem with PEXPECT in Python
- Index(es):
Relevant Pages
|
|