Concurrency

A state in which process(es) exist simultaneously with another process(es) is/are said to be concurrent.

Concurrency is fundamental to multiprogramming, multiprocessing, distributed processing and operating system. Concurrency arises in three different contexts:

Multiple applications, structured applications and operating system structure (Stallings).

For essential reading on concurrency, click here 

PRINCIPLES OF CONCURRENCY

In a single-processor multiprogramming system, processes are interleaved in time to yield the appearance of a simultaneous execution . Even though actual parallel processing is not achieved and  certain overhead is involved in switching back and forth between processes, interleaved execution provides major benefits in processing efficiency and program structuring. In a multiple-processor system, it is possible not only to interleave processes but to overlap them .

Both interleaved and overlapped processes can be viewed as examples of concurrent processes, they both present the same problems. In the case of a uniprocessor, the problems stem from a basic characteristic of multiprogramming systems: The relative speed of execution cannot be predicted. It depends on the activities of other processes, the way the operating system handles interrupts and the scheduling policies of the operating system. the following difficulties arise:

  1. The sharing of global resources is fraught with peril. If two processes both make use of a global variable and both perform reads and writes on that variable, then the order in which the various reads and writes  are executed is critical. 

  2. It is difficult for the operating system to manage the allocation of resources optimally. It may be inefficient for the operating system to simply lock the channel and prevents its use by other processes.

  3. It becomes very difficult to locate a programming error, because reports are usually not reproducible.

All of the foregoing difficulties present themselves in a multiprocesor system as well , because here too the relative speed of execution of processes is unpredictable. A multiprocessor system must also deal with problems arising from the simultaneous execution of multiple processes. (Stallings pp 187)

SYNCHRONIZATION

The process in which operating systems have to regulate the order in which processes access data is known as synchronization. A major problem normally encountered in multiprocessing (and/ or multi-thread) operating environment is synchronisation.

 

If concurrent processes are entirely different subsets of system resources, there is no problem, but if concurrent processes attempt to make use of the same systems resource at the same time, eg, accessing a particular data file, then there would be problem

SYNCHRONIZATION ISSUES

From Systems Integration Handbook (pp 98) , the following synchronization issues were talked about as;

Mutual Exclusion - Method of ensuring that when one process is accessing a shared resource (file or variable), the others are excluded from doing the same.

Race condition - When two concurrent processes are sharing the same storage area.

Critical Section - The mechanism for preventing two processes from accessing the same critical area."

Garry (pp 82,190-192,199)1talked about these issues as follows;

Critical Section - A segment of code that cannot be executed while while some other process is in a corresponding segment of code

Race condition - A condition in which the behaviour of two or more processes depends on the relative rate at which each process executes its program.

Mutual Exclusion - Two or more processes co-operating so that only one of the processes has access to a shared resource at a time.

Stallings, described critical section as the portion of a program that uses a non-sharable resource known as the critical resource.

MUTUAL EXCLUSION

Mutual exclusion is one of  the control problems faced in the case of competing processes. The enforcement of mutual exclusion creates two additional control problems; deadlock and starvation (Stallings)

Mutual exclusion has two levels of concurrency:

  1. Concurrency among processes

  2. Concurrency among activities (threads) with a single process. (Handbook pp 98)

If concurrent processes or activities do not access common resources, there is no problem, but there s a problem if they do. A solution to this problem is to keep the critical activities sequential rather than concurrent. This solution is not always practical.

problems in achieving mutual exclusion includes lockstep, loss of mutual exclusion, deadlock and indefinite postponement.

                                  

   Go back to page 9                      Go to page 11 of 17   

Design by: Idahosa Osa Ojo