python threads?

Kristian Hermansen kristian.hermansen-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sun May 27 13:06:32 EDT 2007


On 5/27/07, Stephen Adler <adler-wRvlPVLobi1/31tCrMuHxg at public.gmane.org> wrote:
> Spawning 3 threads, I get 115%.... So I'm wondering why the python
> thread does not use up two full CPU's? My code, and some time commands
> follow...

I believe that this was a purposeful design decision, but I can't dig
up the reference right now.  I think I read it in the Python 2.5
tutorial.  In any event, Python threading has many flaws and you will
encounter them as you experiment.  Maybe you could try utilizing an
event-based architecture rather than spawning off a slew of threads...

Check out the Twisted library for Python, which is event-based and
geared for networking tasks...
-- 
Kristian Hermansen

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.






More information about the Discuss mailing list