- Java concurrency
-
The Java language and the JVM (Java Virtual Machine) have been designed to support concurrent programming, and all execution in 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. Thread synchronization ensures that objects are modified by only one thread at a time and that threads are prevented from accessing partially updated objects during modification by another thread. The Java language has built-in constructs to support this coordination.
Contents
Monitor synchronization in Java
The key synchronization concept for JVM concurrency 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.
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.
History
Since JDK 1.2, Java has included a standard set of collection classes, the Java collections framework
Doug Lea, who also participated in the Java collections framework implementation, developed a concurrency package, comprising several concurrency primitives and a large battery of collection-related classes[1]. This work was continued and updated as part of JSR 166 which was chaired by Doug Lea.
JDK 5.0 incorporated many additions and clarifications to the Java concurrency model. The concurrency APIs developed by JSR 166 were also included as part of the JDK for the first time. JSR 133 provided support for well-defined atomic operations in a multithreaded/multiprocessor environment.
Both the Java SE 6 and Java SE 7 releases introduced updated versions of the JSR 166 APIs as well as several new additional APIs.
See also
- Concurrency (computer science)
- Concurrency pattern
- Doug Lea
- Java collections framework
- Java memory model
Notes
- ^ Doug Lea. "Overview of package util.concurrent Release 1.3.4". http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html. Retrieved 2011-01-01. "Note: Upon release of J2SE 5.0, this package enters maintenance mode: Only essential corrections will be released. J2SE5 package java.util.concurrent includes improved, more efficient, standardized versions of the main components in this package."
References
- 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
- JDK 5.0 concurrency utilities
- Podcast from JavaPolis - 'Concurrency Utilities in JDK 5.0 by Brian Goetz'
- JavaOne 2005 - Concurrency Utilities in Practice
- JavaOne 2005 - Brian Goetz - Simpler, Faster, Better: Concurrency Utilities in JDK Software Version 5.0
- Podcast from JavaPosse - Interview with Brian Goetz on Concurrency in Java 5
- William Pugh's Java Memory Model page
- Java Concurrency Tutorial by Jakob Jenkov
- Thread Safe Java Programming by Vadym Ustymenko
- Java Concurrency Animations by Victor Grazi
Categories:- Java programming language
- Concurrent computing
- Sun Microsystems
- Computer programming stubs
Wikimedia Foundation. 2010.