Java concurrency

The Java programming language and the Java virtual machine (JVM) is designed to support concurrent programming. All execution takes place in the context of threads. Objects and resources can be accessed by many separate threads. Each thread has its own path of execution, but can potentially access any object in the program. The programmer must ensure read and write access to objects is properly coordinated (or "synchronized") between threads.[1][2] Thread synchronization ensures that objects are modified by only one thread at a time and prevents threads from accessing partially updated objects during modification by another thread.[2] The Java language has built-in constructs to support this coordination.

  1. ^ Goetz et al. 2006, pp. 15–17, §2 Thread Safety.
  2. ^ a b Bloch 2018, pp. 126–129, Chapter §11 Item 78: Synchronize access to shared mutable data.