Java Concurrency
From Suhrid.net Wiki
Concurrent Programming
- The name given to programming notations and techniques to express potential parallelism and solve the resulting communication and synchronization problems.
- Why do we need it ? To allow the expression of potential parallelism so that more than CPU can solve the problem.
- To model the parallelism in the real world.
- Alternative is difficult: programmer must construct sequential program as a cyclic execution of task to handle various concurrent activities.
- This make programming difficult and introduction of structures which are irrelevant to the problem at hand.
- Parallel execution on multiple CPU's is difficult.
- A concurrent program is a collection of autonomous sequential processes executing logically in parallel.
- Each process has a single thread of control.
- The actual implementation of these collection of processes can be via:
- Multiprogramming: Multiple processes multiplex their executions on a single processor.
- Multiprocessing: Multiple processes multiplex their executions on a a multiprocessor system where there is access to shared memory.
- Distributed processing: Multiple processes multiplex their executions on several processors where they do not share memory.