[ANNOUNCE] Garbage collection for Python

Aahz Maruch aahz at netcom.com
Sat Apr 15 17:55:53 EDT 2000


In article <kur9cah4m6.fsf at lasipalatsi.fi>, Erno Kuusela  <erno at iki.fi> wrote:
>>>>>> "Aahz" == Aahz Maruch <aahz at netcom.com> writes:
>
>    >>  Yes.  AFAIK, Python doesn't perform well in a SMP environment,
>    >> because the interpreter only runs on one CPU at a given time,
>    >> even if you create multiple Python threads.
>
>    Aahz> That is true if you stick to pure Python code and extensions
>    Aahz> that don't release the global interpreter lock.  For
>    Aahz> example, if you're using HTTP, the socket library releases
>    Aahz> the global lock and threads are extremely effective.
>
>this won't help much if you would like your code to run on multiple
>cpu:s at once, since socket and file io are not cpu intensive.
>
>i bet switching to another cpu for doing the socket call while letting
>other python threads execute pyth code would decrease performance,
>as moving the thread to another cpu probably costs more than a
>socket syscall.

You don't "move" the thread to a different CPU; the OS handles the
thread scheduling.  And while what you say is true for a single socket
call, it's much less true for a group of fifty or a hundred threads each
doing intensive socket calls.

Also, while I'm talking about the easiest way to get useful threading
out of Python, do keep in mind that *any* extension that releases the
global lock can process in parallel.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac,
and Ritalin?  --Aahz



More information about the Python-list mailing list