JavaMemoryModel: Semantics for yield and sleep

From: Bill Pugh (
Date: Thu Jan 03 2002 - 12:39:09 EST

I agree with those who point out that my proposed semantics for
yield/sleep are insufficient as a basis for building complex
multithreaded applications requiring some kind of fairness in

I also agree that the stronger fairness requirements needed for such
applications are too complicated and too broad in scope in be
included in JSR-133.

However, I still want to argue for the inclusion of the minimal
semantics I proposed for yield/sleep:

* At an invocation of yield/sleep, there is a non-zero chance that
some other thread of equal or higher
   priority will be allowed to execute.

Although this is minimal as far as what you need to build real
systems, it has some fairly clear and precise impacts on the set of
allowed behaviors and compiler transformations. I consider these
semantics necessary but not sufficient. If you had a JVM which didn't
support these minimal semantics, I can't imagine how you could
possibly write multithreaded applications for it.

JavaMemoryModel mailing list -

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