diff --git a/README.md b/README.md index ce45a4d..8b6b11f 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ in the correctness of concurrency support in the JVM, class libraries, and hardw * marks the result object * jcstress ships lots of pre-canned result classes - see `org.openjdk.jcstress.infra.results` package * one of many implementations: `I_Result` (one `int` holder) +### results +![alt text](img/jcstress-report.png) ## happens-before * in computer science, the happened-before relation is a relation between the result of two events, @@ -104,19 +106,19 @@ events are in reality executed out of order (usually to optimize program flow) of actions between them — there is no happens-before relation ## volatile -* Java Memory Model ensures that all threads see a consistent value for the variable -* every read of a volatile variable will be read from the computer's main memory, and not from the CPU cache -* every write to a volatile variable will be written to main memory, and not just to the CPU cache +* Java Memory Model ensures that all threads see a consistent value of the variable +* every read of a `volatile` variable will be read from the computer's main memory, and not from the CPU cache +* every write to a `volatile` variable will be written to main memory, and not just to the CPU cache * prevents compiler / CPU code reordering -* when we write to a volatile variable, it creates a **happens-before** relationship with each subsequent +* when we write to a `volatile` variable, it creates a **happens-before** relationship with each subsequent read of that same variable - * so any memory writes that have been done until that volatile variable write, will subsequently - be visible to any statements that follow the read of that volatile variable -* characterizing the situations under which volatile can be used safely involves determining whether -each update operation can be performed as a single atomic update. + * so any memory writes that have been done until that `volatile` variable write, will subsequently + be visible to any statements that follow the read of that `volatile` variable +* characterizing the situations under which `volatile` can be used safely involves determining whether +each update operation can be performed as a single atomic update ### remarks -* updates to non-volatile long or a double may not be atomic, and -* Java operators like ++ and += are not atomic. -* why an Object member variable can't be both final and volatile in Java? +* updates to non-volatile long or a double may not be atomic +* Java operators like `++` and `+=` are not atomic +* why an `Object` member variable can't be both `final` and `volatile` in Java? * JMM promises that after `ctor` is finished any thread will see the same (correct) value of final field diff --git a/img/jcstress-report.png b/img/jcstress-report.png new file mode 100644 index 0000000..06697d2 Binary files /dev/null and b/img/jcstress-report.png differ diff --git a/results/index.html b/results/index.html deleted file mode 100644 index 5174b61..0000000 --- a/results/index.html +++ /dev/null @@ -1,128 +0,0 @@ - - - -Java Concurrency Stress test report - - - - - - - - -
-

-0% -

- - - -
 
Overall pass rate: 0/1 
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
java.specification.nameJava Platform API Specification
java.specification.vendorOracle Corporation
java.specification.version11
java.vendorJetBrains s.r.o
java.version11.0.4
java.vm.nameOpenJDK 64-Bit Server VM
java.vm.vendorJetBrains s.r.o
java.vm.version11.0.4+10-b304.69
os.archamd64
os.nameWindows 10
os.version10.0
-
-
-

FAILED tests

-

Strong asserts were violated. Correct implementations should have no assert failures here.

- - - - - - - -
   jcstress.HappensBeforeExample108FAILED
-
-
-

ERROR tests

-

Tests break for some reason, other than failing the assert. Correct implementations should have none.

- -
-None! -
-
-
-

INTERESTING tests

-

Some interesting behaviors observed. This is for the plain curiosity.

- -
-None! -
-
-
-

All tests

-

- - - - - - - -
   jcstress.HappensBeforeExample108FAILED
-
- - diff --git a/results/jcstress.HappensBeforeExample.html b/results/jcstress.HappensBeforeExample.html deleted file mode 100644 index daa4de1..0000000 --- a/results/jcstress.HappensBeforeExample.html +++ /dev/null @@ -1,185 +0,0 @@ - - - -Java Concurrency Stress test report - - - -

jcstress.HappensBeforeExample

-

Description and references

-

null

-

Environment

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
java.specification.nameJava Platform API Specification
java.specification.vendorOracle Corporation
java.specification.version11
java.vendorJetBrains s.r.o
java.version11.0.4
java.vm.nameOpenJDK 64-Bit Server VM
java.vm.vendorJetBrains s.r.o
java.vm.version11.0.4+10-b304.69
os.archamd64
os.nameWindows 10
os.version10.0
-

Test configurations

- - - - - - - - - - - - - - - - - - - - - - - - - -
TC 1JVM options: [] -Iterations: 5 -Time: 1000
TC 2JVM options: [-XX:+UnlockDiagnosticVMOptions, -XX:+StressLCM, -XX:+StressGCM] -Iterations: 5 -Time: 1000
TC 3JVM options: [-XX:-TieredCompilation] -Iterations: 5 -Time: 1000
TC 4JVM options: [-XX:-TieredCompilation, -XX:+UnlockDiagnosticVMOptions, -XX:+StressLCM, -XX:+StressGCM] -Iterations: 5 -Time: 1000
TC 5JVM options: [-XX:TieredStopAtLevel=1] -Iterations: 5 -Time: 1000
TC 6JVM options: [-Xint] -Iterations: 5 -Time: 1000
-

Observed states

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Observed stateTC 1TC 2TC 3TC 4TC 5TC 6ExpectationInterpretation
1183852344125914381173363276100871388810510081580828ACCEPTABLEActor2 is executed before Actor1
23477492142283647703212674251ACCEPTABLEActor2 is executed after y = 2 and before x = 3 in Actor1
36562860961418435980950917610FORBIDDENy = 2 can not be reordered with x = 3 as we have volatile on x
617256442361898541162023556428939225021596818689ACCEPTABLEActor2 executed after Actor1
FAILEDFAILEDFAILEDFAILEDFAILEDFAILED
-

Auxiliary data

- -