Re: JavaMemoryModel: Problem with Thread.sleep

From: David F. Bacon (dfb@watson.ibm.com)
Date: Sun Oct 24 1999 - 15:21:12 EDT


I think you are getting a bit far afield of the kind of changes that could
reasonably be made to the Java language given its wide deployment.

The problem isn't with sleep. The problem is that the way load/read/use are
defined (don't have the book at home, so I can't quote it) it is completely
legal and even encouraged to write code that polls a variable modified by
another thread without synchronization.

I think it would break an awful lot of code to change this.

Unsynchronized readers are required in Java because it provides no read locks,
only write locks. This is probably due to its heritage as a language for
embedded machines, which are mostly uniprocessors. On MPs, you need multiple
reader/single writer concurrency control.

Java's approach is essentially a hack.

I won't be able to make OOPSLA and the JMM BOF, but I do have one suggestion:
see if you can implement an efficient (concurrent reader) hash table on an MP
in whatever models you propose.

Regards,
david



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:20 EDT