Question about Python threads

Rodrigo Augusto Barbato Ferreira rodrigo.ferreira at
Thu Aug 29 22:33:52 CEST 2002

Patricia Shanahan <pats at> wrote in message 
> Artur Biesiadowski wrote:
> > 
> > Patricia Shanahan wrote:
> > 
> > >>Problems was with synchronization being defined too strict. To implement
> > >>it, full cache flush would be required on each synchronization. No JVM
> > >
> > >
> > > I don't see the reasons for this. Could you explain further?
> > 
> > hour ago to be propagated to all threads on all processors. It requires
> > writing all cache of given processor to main memory and invalidating
> > caches for these pieces of memory for rest of processors. Latter part is
> > not a big performance problem - former is.
> No it does not, if the caches maintain coherence among themselves.

I think there is a confusion here, the cache being flushed is not the
processor cache but the java thread cache. Each java thread may cache
values read from the shared heap locally in registers or in the stack
frame. When it finds a readbarrier it discards all cached values and
read them again from the shared memory. When it finds a writebarrier
this cache is flushed which means values kept in registers and stack
frame slots are written back to the shared heap.
At implementation level, in a multi-processor system, every java
thread must see the same shared heap, so when writting to the shared
memory the value must be broadcast to all threads.
This may require a processor cache flush, or not, as in that case
where there is coherence between processor caches.


Rodrigo Augusto Barbato Ferreira
{M|B}.S. Computer Science, U{NICAMP|FMG}/BRAZIL
Visit the Jewel VM Project at

More information about the Python-list mailing list