Jython, GILs and object locking.

Pettersen, Bjorn S BjornPettersen at fairisaac.com
Fri Oct 10 21:39:38 EDT 2003


> From: Jon Franz_antispam [mailto:jfranzXREMOVEX at neurokode.com] 
> 
> > Most of the I/O code that's built into python, already does this.
It's
> > written in C, and the C code releases the GIL before engaging in the
> > operation. Or, I should add, so I have been informed by previous
> > beatings of this horse carcass.
> 
> I have yet to see such code run on a seperate cpu, but I may 
> be mistaken...
> I'll make some test cases.

Why would IO code called from _your_ thread run on a different cpu? Your
thread is blocked, waiting for the IO to finish. While it is blocked,
however, it does _not_ hold the gil -- thus other threads can run on
both _your thread's_ processor, as well as any other processors you can
get the os to schedule them on. Ergo, this is probably the case where
the gil has the _least_ impact.

-- bjorn





More information about the Python-list mailing list