Java Concurrency - Happens-before Relationship

Java Conceptuel Diagram

About

Data Concurrency - Happens Before relationship in Java

Java

The following actions create happens-before relationships:

  • synchronized construct. When a thread releases an intrinsic lock, a happens-before relationship is established between that action and any subsequent acquisition of the same lock.
  • volatile constructs
  • Thread.start: Every statement that has a happens-before relationship with that statement also has a happens-before relationship with every statement executed by the new thread. The effects of the code that led up to the creation of the new thread are visible to the new thread.
  • Thread.join. All the statements executed by the terminated thread have a happens-before relationship with all the statements following the successful join. The effects of the code in the thread are now visible to the thread that performed the join.

For a list of actions that create happens-before relationships, refer to the Summary page of the java.util.concurrent package..

Documentation / Reference





Discover More
Data System Architecture
Concurrency - (Shared) Memory Inconsistency

Errors that result from inconsistent views of shared memory. Memory consistency errors occur when different threads have inconsistent views of what should be the same data. The results of a write by...
Java Conceptuel Diagram
Java Concurrency - (Concurrent) Collections

All of the concurrent collections help avoid Memory Consistency Errors by defining a happens-before relationship between: an operation that adds an object to the collection with subsequent operations...
Java Conceptuel Diagram
Java Concurrency - Monitor (Intrinsic|Implicit) Lock

Synchronization is built around an internal object property known as: intrinsic lock monitor lock implicit lock or simply monitor. Each object in Java is associated with a monitor, which a thread...
Java Conceptuel Diagram
Java Concurrency - Synchronized method

Synchronized method To make a method synchronized, simply add the synchronized keyword to its declaration: A synchronized method: performs a lock action when it is invoked; its body is not executed...
Thread Java Mission Control
Java Concurrency - Thread

Every application has at least one thread . From the application programmer's point of view, you start with just one thread, called the main thread. From this thread, you can start other threads. ...



Share this page:
Follow us:
Task Runner