We don't have hint code for Java. And we don't think you need any hint code to get it done. For further information on the file format please visit tutorial. For more on threads and locks official language spec Chapter 17
Xinyu provided examples to help you have a better understanding on Java objects.
Remember not to include your name / ID in report.
jar xf jmm.jarThen you should see the jmm folder.
jar cvf jmmplus.jar *.javaAll in homework spec.
From UnsafeMemory class you call all the remaining classes. Please uncomment line 16 to 19 in UnsafeMemory.java to make the options you implemented available for debugging and testing.
javac *.javaFor your debugging purpose (just an example, you should try different parameters):
java UnsafeMemory Synchronized 8 100000000 5means run our UnsafeMemory java class with parameters: Synchronized 8 100000000 5.
- SynchronizedState implementation
- divide the work into 8 threads of roughly equal size
- do 100000000 swap transitions total
- use a state array of 5 entries
To test:
time timeout 3600 java UnsafeMemory Synchronized 8 100000000 5- time: use real, user and system time (a discussion might be useful for you to understand the time measurements)
- timeout 3600: run
java UnsafeMemory Synchronized 8 100000000 5and wait for 3600 seconds, such that it won't loop forever