[Tutor] Threading in Python
mlangford.cs03 at gtalumni.org
Thu Sep 20 07:10:01 CEST 2007
Python has no way to force the OS to schedule a process on a given processor
(therefore you're safe). If you use multiple processes, you can get true
concurrency. This is one of the reasons process based concurrency is
superior to threads (*ducks from items thrown by threadophiles*).
Then again, you don't have a shared memory space, so get used to using
pickle if you don't have another text protocol to send data back and forth.
On 9/19/07, James <jtp at nc.rr.com> wrote:
> Hi. :)
> I have a question regarding threading in Python. I'm trying to write
> a wrapper script in Python that will spin off multiple (lots!) of
> instances of an I/O benchmark/testing utility. I'm very interested
> in doing this in Python, but am unsure if this is a good idea. I
> thought I read somewhere online that because of the way Python was
> written, even if I spun off (forked off?) multiple instances of a
> program, all those child processes would be restricted to one CPU.
> Is this true?
> I'm not sure if the utility I'm forking is CPU-intensive; it may very
> well be. Does Python indeed have this limitation?
> Also, should I be using os.fork() for this kind of program?
> Thoughts/ideas appreciated. :)
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor