Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (18 sloc) 1.3 KB

Concurrency explained

Concurrency in Java is hard to get right. Even experts are struggling.

Using examples, we will try to go through the main examples of what works.

We won’t care about performance, liveliness, locks and so on. We will care about correctness according to the Java Memory Model (JMM). About data publication. We will answer this simple question: "Will we ever get out of the loop?".

Gotcha: It is quite frequent to see a perfectly working program that, in fact, doesn’t comply with the JMM. Why? Because CPUs and JVM implementations are stricter than what the JMM allows.

Bottom line, you should never assume that your nicely working code is in fact correct.