Is Stackless and uthread.py SMP friendly?
Aahz Maruch
aahz at panix.com
Fri Dec 15 15:15:16 EST 2000
In article <91dt39$fbk$1 at nnrp1.deja.com>, <jbalding at hotmail.com> wrote:
>
>Okay. My next question: Is there a simple way of taking advantage of
>multiple processors using Python, or is this something that is going to
>be like pulling teeth? In other words, are there existing packages that
>allow relatively high-level, transparent access to multiple processors?
Yes. Use threading.Thread(). The caveat is that Python has a global
interpreter lock that prevents more than one thread from running when
using pure Python code (e.g. "for i in range(1000): pass"). You can
solve this either by using calls that release the lock (e.g.
file.read() and many other I/O calls) or by writing a C extension that
explicitly releases the lock.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"It's 106 miles to Chicago. We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses." "Hit it."
More information about the Python-list
mailing list