Dedicated CPU core for Python?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 28 03:14:26 EDT 2007


Joshua J. Kugler ha escrito:

> On Thursday 26 April 2007 14:07, Gabriel Genellina wrote:
>
> > En Thu, 26 Apr 2007 15:54:38 -0300, Joshua J. Kugler
> > <joshua at eeinternet.com> escribió:

> >> CPython only
> >> uses one
> >> CPU core right now because it's threads are all internal, and do not
> >> spawn system threads (IIRC).
> >
> > Python threads are OS threads:
> > http://docs.python.org/lib/module-thread.html
> > "[The thread module] is supported on Windows, Linux, SGI IRIX, Solaris
> > 2.x, as well as on systems that have a POSIX thread (a.k.a. ``pthread'')
> > implementation."
>
> Yes, that may be, but they are not true system threads, or at least do not
> appear to be.  Threads on linux each show up as a separate process.  I can
> have several threads in my Python program, but no additional processes show
> up in ps -A.  I don't see how Python threads can be system threads with the
> GIL.  But, I've been wrong before, and threads are something I have very
> light knowledge of.

Try with ps -L

gag at 4[~]$ ps -L -C python
  PID   LWP TTY          TIME CMD
 3952  3952 pts/1    00:00:03 python
 3952  3956 pts/1    00:00:00 python
 3952  3957 pts/1    00:00:00 python
 3952  3958 pts/1    00:00:00 python
 3952  3959 pts/1    00:00:00 python
 3952  3960 pts/1    00:00:00 python
 3952  3961 pts/1    00:00:00 python
 3952  3962 pts/1    00:00:00 python

Or ps --help depending on your system.

--
Gabriel Genellina




More information about the Python-list mailing list