Concurrency is the computation of processes within a time frame to give an impression of simultaneous execution. Here, it's important to note that this is not the same thing as actually running simultaneously.
Concurrency can actually be looked at as the
competition of multiple processes for the same resource. Although it's a
competition between the processes, the loser of the race is the one that
actually has the final value.
True parallelism would allow for the simultaneous execution of the processes, but concurrent processes do not exhibit parallelism. Concurrency results in the following issues:
- Problems with the sharing of global resources
- Problems in allocating resources and
- Programming issues because multiple processes update the same resource, which is difficult to reproduce.
In the above diagram, all the four threads
are running concurrently. However, only one of them can be scheduled on a
processor at a time.
In the above diagram, all
the four threads are running in parallel i.e. they are executing at the same
time.
0 Comments