In a manic moment (OK - a manic few hours), I have reconstructed the lost
code I wrote to model an algorithm that implements the original threading
model specification. In the model I create my own class to represent Java
object monitors, and use Java synchronization to represent the underlying
mutex and notify/wait offering.
The underlying mutex does not need to support recursive locking, and the
notify/wait mechanism may produce spurious wakeups.
I believe that the algorithm illustrated by the model has the following
1). No spurious wakeups.
2). No lost notifications.
3). Interrupts and notifications affecting the same object/thread which
have a definite program order produce a predictable outcome.
4). No redundant context switches.
5). No locks of wide scope. In particular, no JVM wide global lock. The
only locks used have thread and object scope.
The code, and a test program, can be found at
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:53 EDT