[Twisted-Python] Can I benefit from multi-processor hardware?
Phillip J. Eby
pje at telecommunity.com
Mon May 24 00:56:38 EDT 2004
At 01:03 PM 5/24/04 +0900, June Jae-jun Kang wrote:
>Can we still benefit from multi-processor hardware with Twisted s basic
Only if you use multiple processes. The Python interpreter has a global
lock that's used to protect potentially shared data structures, so this
inhibits multi-processor execution of pure Python code. Portions of a
Python program that are written in C or C++ can be free-threaded, but if
you are doing code that's pure Python, you'll need multiple processes.
So, to take advantage of multi-processor hardware, you can do your
calculation-intensive work in separate processes, with the network
communications being handled by an event-driven front end. Note that this
is basically true for *any* Python program, not just Twisted.
More information about the Twisted-Python