Parallelization on muli-CPU hardware?

Bryan Olson fakeaddress at nowhere.org
Mon Oct 11 23:46:15 EDT 2004


Piet van Oostrum wrote:

 >>>>>>Bryan Olson <fakeaddress at nowhere.org> (BO) wrote:
 > BO> I'm not really up-to-date on modern multi-processor support.
 > BO> Back in grad school I read some papers on cache coherence, and I
 > BO> don't know how well the problems have been solved.  The issue
 > BO> was that a single processor can support a one-instruction lock
 > BO> (in the usual no-contention case) simply by supplying an
 > BO> uninterruptable read-and-update instruction, but on a multi-
 > BO> processor, all the processors have respect the lock.
 >
 > For multiprocessor systems, uninterruptible isn't enough (depending 
on your
 > definition of uninterruptible). Memory operations from other processors
 > also shouldn't interleave with the instruction. Modern processors usually
 > have a 'test and set' or 'compare and swap' instruction for this purpose,
 > which lock memory for the duration of the operation.

I'm with you that far.  The reason I mentioned cache coherence
is that locking memory isn't enough on MP systems.  Another
processor may have the value in local cache memory.  For all the
processors to respect the lock, they have to communicate the
locking before any processor can update the address.

If every thread treats a certain memory address is used as lock,
each can access it only by instructions that go to main memory.
But then locking every object can have a devastating effect on
speed.


--
--Bryan Olson
(who, incidentlly, hates his initials)



More information about the Python-list mailing list