Question about Python threads

Artur Biesiadowski abies at pg.gda.pl
Wed Aug 28 07:19:10 EDT 2002


Armin Steinhoff wrote:

>>JVM has quite well defined semantics in presence of multiple threads 
>>(including multiple processors). There are some small problems with 
>>multiprocessor cache and synchronization - java memory model is in 
>>process of being relaxed to allow optimized implementation.
> 
> 
> So the 'well defined semantic' isn't yet very well defined ... the
> processing model of JVM is at the end also not designed for
> multi-processor systems.


To be more precise.

It was well defined. It clearly stated what values field can have for 
different processors given arbitrary number of threads and 
synchronizations. For example, it was defined that int64 (long) access 
to not have to be atomic - if you want to enforce atomiticy (sp?) you 
need to wrap it in synchronization. For me, explictly saying that JVM 
can update two halfs of long in non-atomic manner is a 'definition'.

Problems was with synchronization being defined too strict. To implement 
it, full cache flush would be required on each synchronization. No JVM 
implemented it - so we can say that all JVMs were not up to spec. Now, 
this specification is being relaxed - to reflect what was really 
implemented in JVMs to get reasonable performance. But again, it will be 
defined - even if it will say that value can be 0 or 1, random.

But all this stuff is really not so important. What is important, is 
that you can use java with multiple threads and also interact with 
native threads.


Artur




More information about the Python-list mailing list