Concurrency:
- The way operating system handles interrupts
- Other processes' activities
- The operating system's scheduling policies
Problems in Concurrency
There are various problems in concurrency. Some of them are as follows:
1. Locating the programming errors
It's difficult to spot a programming error because reports are usually repeatable due to the varying states of shared components each time the code is executed.
2. Sharing Global Resources
Sharing global resources is difficult. If two processes utilize a global variable and both alter the variable's value, the order in which the many changes are executed is critical.
hh3. Locking the channel
It could be inefficient for the OS to lock the resource and prevent other processes from using it.
4. Optimal Allocation of Resources
It is challenging for the OS to handle resource allocation properly.
Issues of Concurrency
1. Non-atomic
Operations that are non-atomic but interruptible by several processes may happen issues. A non-atomic operation depends on other processes, and an atomic operation runs independently of other processes.
2. Deadlock
In concurrent computing, it occurs when one group member waits for another member, including itself, to send a message and release a lock. Software and hardware locks are commonly used to arbitrate shared resources and implement process synchronization in parallel computing, distributed systems, and multiprocessing.
3. Blocking
A blocked process is waiting for some event, like the availability of a resource or completing an I/O operation. Processes may block waiting for resources, and a process may be blocked for a long time waiting for terminal input. If the process is needed to update some data periodically, it will be very undesirable.
4. Race Conditions
A race problem occurs when the output of a software application is determined by the timing or sequencing of other uncontrollable events. Race situations can also happen in multithreaded software, runs in a distributed environment, or is interdependent on shared resources.
5. Starvation
A problem in concurrent computing is where a process is continuously denied the resources it needs to complete its work. It could be caused by errors in scheduling or mutual exclusion algorithm, but resource leaks may also cause it.