Question about Python threads
a-steinhoff at web.de
Sat Aug 24 19:14:03 CEST 2002
"Stuart D. Gathman" <stuart at bmsi.com> wrote in message news:<wNW89.72956$Pb.3188993 at news2.east.cox.net>...
> On Wed, 21 Aug 2002 14:18:38 -0400, Mr. Neutron wrote:
> > 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.
> > 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.
> That is correct. Current CPython code cannot use more than one CPU. A C
> extension can release the GIL and get some parallelism (being careful to
> reacquire the GIL before calling any Python API) - but that is probably
> more trouble than its worth.
> > How does this problem imply to Java as well?
> Java threads are mapped to real OS threads (not necessarily one to one).
Python threads are also real OS threads.
> Java has no trouble taking advantage of multiple CPUs.
I believe that's a wrong conclusion :)
Jave should have the same problems as Python .. if the JAVA VM isn't
thread safe. Is the JAVA VM thread safe ??
More information about the Python-list