Question about Python threads

Mr. Neutron nicktsocanos at charter.net
Wed Aug 21 14:18:38 EDT 2002


Hello,
  If I understand, only one thread can be in the interpreter at any time.
Now what I don't understand is being in the interpreter at a time part.

I have written threaded programs with Python and it works great. I am
really impressed with Python so far. Now my problem is I have a Dual
P2450. I want to write a program on it that takes advantage of both CPUs.
My understanding of SMP is that threads are distributed on the CPUs by
the kernel, so threads can be executing on both CPUs at once. This is
exactly what I want to do,l as I have processes I want to run on them
in threads. I am comfortable with using threads, it isn't the problem.
It is my interpretation of how Python operates in threads on multiple
CPUs at the same time that is bothering me. Or really my understanding of
how Python threads work.

Now the first thing that comes to mind is, that if only one thread can be
in the interpreter at any time, the other CPU running a thread has to be
blocked. Is my interpretation correct? It would seem that it would run
very slowly, and not perform better than a single CPU system than.

I guess people would say, if you want to do stuff like this, use a real
language like C. I have ok!!!. I like Python. I like it's ease of use. I
think it is a great language. I am highly impressed with it. I like
programming in it. Ok?!! I can do it in C if I want do, but my philosophy
if there is a problem with Python, then figure out how to change Python
so there is no problem anymore. Capiche? I can always use Cilk to do what
I want to do if I need realtime performance anyways!! I just am curious
about this problem and my interpretation of how Python works!!

How does this problem imply to Java as well? 

Thanks



More information about the Python-list mailing list