summaryrefslogtreecommitdiffstats
path: root/Doc/howto
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-05 00:32:29 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-05 00:32:29 (GMT)
commitfa03f6c863c35204af5b618454f530dc5094ccff (patch)
treee8bcc370a2a295dab16847fc69ba0d914a2a4d84 /Doc/howto
parent534e253cb6ca13fa790b9fbe5359c88e779722f6 (diff)
downloadcpython-fa03f6c863c35204af5b618454f530dc5094ccff.zip
cpython-fa03f6c863c35204af5b618454f530dc5094ccff.tar.gz
cpython-fa03f6c863c35204af5b618454f530dc5094ccff.tar.bz2
Remove the outdated notion that multithreading doesn't work well on Unices.
Diffstat (limited to 'Doc/howto')
-rw-r--r--Doc/howto/sockets.rst20
1 files changed, 7 insertions, 13 deletions
diff --git a/Doc/howto/sockets.rst b/Doc/howto/sockets.rst
index 04e9b98..3d8ade9 100644
--- a/Doc/howto/sockets.rst
+++ b/Doc/howto/sockets.rst
@@ -395,19 +395,13 @@ Performance
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.
-
-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.
+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. 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