Alex Rivera | Logout

Is there a worst case implementation of the JVM?

Asked 2009-02-16T19:43:58.090
9

The Java memory model makes it clear what can and cannot be assumed about how threads interact through memory. For example, if one thread writes a new value to a field without appropriate synchronization then the new value is not guaranteed to be observable by other threads. In practice, however, other threads might anyhow read the new value in spite of inadequate synchronization, depending on time between write and read, hardware architecture, etc.

This can lead to bugs that are hard to discover and difficult to reproduce. It could therefore be useful to run a java application on a worst case JVM that did absolutely no memory synchronization between threads beyond the guarantees in the Java memory model. Does such a worst case JVM implementation exist?

Edit
Report

1 Answer

0

I don't know of any VM which guarantees worst case behavior all the time, which seems to be what you are asking for. The situation that you are describing can occur with Sun VMs (as well as many others), but only due to caching issues. I'm not familiar with a VM that intentionally does this all of the time.

answered 2009-02-16T19:52:32.407

Your Answer