Parallelization on muli-CPU hardware?

Bryan Olson fakeaddress at nowhere.org
Sun Oct 10 00:45:52 EDT 2004


Paul Rubin wrote:
 >
 > Bryan Olson writes:
 >>So what's the solution?  A global-interpreter-lock works; that's
 >>what Python has now; but we lose much of the power of multi-
 >>processing systems.   We could give every object its own lock,
 >>but the locking overhead would defeat the purpose (and inter-
 >>object conditions can be trickier than they might look).
 >
 > Giving every object its own lock is basically what Java does.  Is it
 > really so bad, if done right?  Acquiring or releasing the lock can be
 > just one CPU instruction on most reasonable processors.  I've been
 > wondering about this for a while.

I'm not really up-to-date on modern multi-processor support.
Back in grad school I read some papers on cache coherence, and I
don't know how well the problems have been solved.  The issue
was that a single processor can support a one-instruction lock
(in the usual no-contention case) simply by supplying an
uninterruptable read-and-update instruction, but on a multi-
processor, all the processors have respect the lock.


-- 
--Bryan



More information about the Python-list mailing list