Documente Academic
Documente Profesional
Documente Cultură
LOREDANA P.
Concurrency
Multi-threaded processing allows operating systems to execute threads at the same time. The property of
executing multiple threads and processes at the same time is referred to as concurrency.
The java.util.concurrent package provides utility classes for creating concurrent applications. Other often used packages
for concurrency are: java.util.concurrent.locks and java.util.concurrent.atomic.
• Executors - define a high-level API for launching and managing threads. Executor implementations from the
java.util.concurrent package provide thread pool management suitable for large-scale applications.
• Concurrent collections make it easier to manage large collections of data, and can greatly reduce the need for
synchronization.
• ThreadLocalRandom provides efficient generation of pseudorandom numbers from multiple threads.
• Lock objects support locking idioms that simplify many concurrent applications.
• Atomic variables have features that minimize synchronization and help avoid memory consistency errors.
CONCURRENCY
Executors
Executor Interfaces
EXECUTORS
Thread Pools
Fork/Join
• The fork/join framework is an implementation of the ExecutorService
interface that helps you take advantage of multiple processors. It is
designed for work that can be broken into smaller pieces recursively. The
goal is to use all the available processing power to enhance the performance
of the application.
EXECUTORS
Concurrent collections
CONCURRENT COLLECTIONS
Synchronization
Synchronization Libraries
SYNCHRONIZATION
ThreadLocalRandom
• Only one thread can own an implicit Lock object at a time. Lock
objects also support a wait/notify mechanism, through their associated
Condition objects.
LOCK OBJECTS
Atomic variables
All classes have get and set methods that work like reads and writes on
volatile variables.
LOCK OBJECTS
Bibliography
• https://docs.oracle.com/javase/8/docs/api/index.html?java/util/co
ncurrent/package-summary.html
• Illustrations: https://www.cartoonstock.com/
BIBLIOGRAPHY