Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

readme.md

About HW3: Java

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.

About the .jar format

To Unzip the .jar file

jar xf jmm.jar

Then you should see the jmm folder.

To zip your solutions

jar cvf jmmplus.jar *.java

Explanations of Requirements

All 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.

To compile

javac *.java

To run / test

For your debugging purpose (just an example, you should try different parameters):

java UnsafeMemory Synchronized 8 100000000 5

means 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 5 and wait for 3600 seconds, such that it won't loop forever