next up previous
Next: The Java Memory Model Up: Fixing the Java Memory Previous: Fixing the Java Memory

Introduction

The Java memory model, as described in chapter 17 of the Java Language Specification [GJS96], is very hard to understand. Research papers that analyze the Java memory model interpret it differently [GS97,CKRW97,CKRW98]. Guy Steele (one of the authors of [GJS96]) was unaware that the memory model prohibited common compiler optimizations, but after several days of discussion at OOPSLA98 agrees that it does.

Given the difficulty of understanding the memory model, there may be disagreements as to whether the memory model actually has all of the features I believe it does. However, I don't believe it would be profitable to spend much time debating whether it does have these features. I am convinced that the existing style of the specification will never be clear, and that attempts to patch the existing specification by adding new rules will make even harder to understand. If we decide to change the Java memory model, a completely new description of the memory model should be devised.

In addition to the problem that the memory model is very hard to understand, it has two basic problems: it is too weak and it is too strong. It is too strong in that it prohibits many compiler optimizations and requires many memory barriers on architectures such Sun's Relaxed Memory Order (RMO). It is too weak in that much of the code that has been written for Java, including code in Sun's JDK, is not guaranteed to be valid.


next up previous
Next: The Java Memory Model Up: Fixing the Java Memory Previous: Fixing the Java Memory
William Pugh