Java concurrency

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

Java is a programming language (and API) which has been designed to support concurrent programming, and all execution in the language takes place in the context of a thread. It is important for a Java programmer to understand both the power and limitations of Java threads.

In the JVM (Java Virtual Machine), 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 that threads do not interfere with each other, and that resources are properly coordinated (or "synchronized") during both read and write access. The Java language has built-in constructs to support this coordination.

The Java Language Specification does not say how the JVM designer should implement the multithreading primitives specified, because there is so much variation among the various operating systems and hardware on which the JVM is expected to run.


Monitor synchronization in Java

The key synchronization concept in Java is the monitor. Every object in a JVM has a monitor associated with it. Such monitor-based concurrency was originally introduced with the Mesa programming language.

Changes in Java 5

Java 5 incorporated many additions and clarifications to the Java concurrency model. JSR 133 provided support for well-defined atomic operations in a multithreaded/multiprocessor environment, opening the door to JSR 166, a large battery of concurrent programming APIs.

See also


  • Goetz, Brian; Joshua Bloch, Joseph Bowbeer, Doug Lea, David Holmes, Tim Peierls (2006). Java Concurrency in Practice. Addison Wesley. ISBN 0-321-34960-1. 
  • Lea, Doug (1999). Concurrent Programming in Java: Design Principles and Patterns. Addison Wesley. ISBN 0-201-31009-0. 

External links

Personal tools

Served in 0.588 secs.