Concurrency encompasses a host of design issues, including communication among processes, sharing and competing for resources (such as memory, files, and I/O access), synchronization of the activities of multiple processes, and allocation of processor time to processes. If more than one thread exists in system at once, these threads can execute independently or in cooperation.
The problems with concurrent execution can be expressed as follows:
- Concurrent processes (or threads) often need access to shared data and shared resources.
- If there is no controlled access to shared data, it is possible to end up with an inconsistent view of this data.
- Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes.
- Race conditions may arise due to different order of the relative execution of various programs.