[Stackless] Stackless on SMP

Bob Ippolito bob at redivi.com
Mon May 24 00:32:18 CEST 2004

On May 23, 2004, at 6:15 PM, Isaac wrote:

> Bob Ippolito wrote:
>> On May 23, 2004, at 5:38 PM, Isaac wrote:
>>> Bob Ippolito wrote:
>>>> On May 23, 2004, at 4:42 PM, Isaac wrote:
>>>>> This might be an FAQ, but I'm not finding it anywhere...
>>>>> How well does Stackless take advantage of machines with multiple 
>>>>> processors, or Intel's Hyper-threaded processors?
>>>> It doesn't.  Python (CPython and derived implementations such as 
>>>> Stackless anyway) is designed in such a way that makes it 
>>>> impossible to take advantage of threads.  If you want to take 
>>>> advantage of multiple execution contexts then you need to use 
>>>> separate processes.
>>> Is there any hope for use poor neglected SMPers? Or is the problem 
>>> too deeply rooted in Python's design?
>> As I said, use separate processes if you need to distribute 
>> computation.  It's generally much easier to code and debug, and it 
>> has the added bonus that if you design your application in this way 
>> then you can easily distribute it amongst multiple computers, or on a 
>> single box with a bunch of CPUs.
> But isn't there also a lot of overhead for using multiple full-out 
> instances of the interpreter in terms of memory, etc?

It's probably negligible.

That's why we have /shared/ libraries (trust me, it wasn't to 
facilitate dependency hell).  Let's say all of the code and constant 
data in Python takes up 20mb.  That's a flat fee.  It's shared by all 
of the running Python processes.

So then you just have the Python objects to worry about.. a few of 
global objects per interpreter (code, modules, etc.), plus whatever 
objects you need for your computation (which would probably be 
per-thread or whatever anyways).

This is the only way to do it with the mainline implementation of 
Python.  Take it or leave it.  It's a more scalable model than threads, 
and more sane to develop in especially in a language such as Python 
that isn't designed (just talking syntax and semantics here, not even 
the current implementation) to do concurrency.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20040523/7887ffda/attachment.bin>
-------------- next part --------------
Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list