[Python-checkins] cpython (3.2): Remove the outdated notion that multithreading doesn't work well on Unices.

antoine.pitrou python-checkins at python.org
Mon Dec 5 01:53:05 CET 2011


http://hg.python.org/cpython/rev/64d980770571
changeset:   73860:64d980770571
branch:      3.2
parent:      73858:427b9dae1ae3
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Mon Dec 05 01:32:29 2011 +0100
summary:
  Remove the outdated notion that multithreading doesn't work well on Unices.

files:
  Doc/howto/sockets.rst |  18 ++++++------------
  1 files changed, 6 insertions(+), 12 deletions(-)


diff --git a/Doc/howto/sockets.rst b/Doc/howto/sockets.rst
--- a/Doc/howto/sockets.rst
+++ b/Doc/howto/sockets.rst
@@ -395,19 +395,13 @@
 
 There's no question that the fastest sockets code uses non-blocking sockets and
 select to multiplex them. You can put together something that will saturate a
-LAN connection without putting any strain on the CPU. The trouble is that an app
-written this way can't do much of anything else - it needs to be ready to
-shuffle bytes around at all times.
+LAN connection without putting any strain on the CPU.
 
-Assuming that your app is actually supposed to do something more than that,
-threading is the optimal solution, (and using non-blocking sockets will be
-faster than using blocking sockets). Unfortunately, threading support in Unixes
-varies both in API and quality. So the normal Unix solution is to fork a
-subprocess to deal with each connection. The overhead for this is significant
-(and don't do this on Windows - the overhead of process creation is enormous
-there). It also means that unless each subprocess is completely independent,
-you'll need to use another form of IPC, say a pipe, or shared memory and
-semaphores, to communicate between the parent and child processes.
+The trouble is that an app written this way can't do much of anything else -
+it needs to be ready to shuffle bytes around at all times. Assuming that your
+app is actually supposed to do something more than that, threading is the
+optimal solution, (and using non-blocking sockets will be faster than using
+blocking sockets).
 
 Finally, remember that even though blocking sockets are somewhat slower than
 non-blocking, in many cases they are the "right" solution. After all, if your

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list