Question about Python threads

Gerhard Häring gerhard.haering at
Fri Aug 23 22:56:14 CEST 2002

* Greg Copeland <gtcopeland at> [2002-08-23 15:35 -0500]:
> "Mr. Neutron" <nicktsocanos at> writes:
> > How do I specifically tell in C using pthreads, that I want CPUA()
> > on CPU0 and CPUB() on CPU1? My understanding is you can't specify
> > this on Linux, but I hope I am just limited in my understanding
> You can't specify this on most OS'.  This is called CPU affinity.

AFAIK the Mindcraft benchmark exploited that Windows can set CPU
affinity, while Linux can't. That may be one reason why there are now
cpu affinity patches to the Linux kernel. Though I have a (crappy) SMP
machine here, I've never tried these patches myself.

> > Second, how in C do I access the GIL in python? Where do I look for
> > this or are there any examples of this?


Be cautious with these, it's easy to make errors.

mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

More information about the Python-list mailing list