Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a worst case implementation of the JVM?

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?

like image 815
Inge Avatar asked Feb 16 '09 19:02

Inge


1 Answers

You could try using Terracotta to cluster your program. It is incredibly unforgiving around incorrect synchronization (which will become apparent even with only one node in the cluster). This is a great question: I've often wanted exactly this ability - I'm surprised there's not a switch in the standard JRE -XXJMMExtreme

Terracotta is open-source and free for the basic product.

like image 107
oxbow_lakes Avatar answered Sep 22 '22 06:09

oxbow_lakes