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.
Real time systems
- A real time system is any system which has to respond to a stimuli within a finite and specified period.
- The correctness depends on both the result and the time it was delivered.
- Failure to respond is as bad as the wrong response.
- Types of real time systems
- Hard real-time — systems where it is absolutely imperative that responses occur within the required deadline. E.g. Flight control systems.
- Soft real-time — systems where deadlines are important but which will still function correctly if deadlines are occasionally missed. E.g. Data acquisition system.
- Firm real-time — systems which are soft real-time but in which there is no benefit from late delivery of service.
Characteristics of RTS
- Concurrent control of separate system components.
- Facilities to interact with special purpose hardware.
- Extreme reliability and safe.
- Guaranteed response times.