0

The first bullet point of Memory Consistency Properties is:

  • Each action in a thread happens-before every action in that thread that comes later in the program's order.

I guess this is a relatively recent addition to Java memory model because Jon Skeet didn't mention it in 2011.

What exactly does this bullet point mean in practice? I'm having a hard time making sense of it. Does it simply mean "There are no concurrency issues within a single thread"? Or is there more to it?

fredoverflow
  • 256,549
  • 94
  • 388
  • 662

1 Answers1

1

What exactly does this bullet point mean in practice?

Everything in a thread notionally occurs in the order the program executes (in reality it, instructions can be reordered to make the program run faster)

I'm having a hard time making sense of it.

Most likely you are over thinking it. Imagine you are reading the lyrics of a song. The words in each line happen after all the words before it, and all the words after that line happen after it.

Does it simply mean "There are no concurrency issues within a single thread"?

Yes, there shouldn't but there can be. e.g. The Spectre and Meltdown security issue exploited this.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130