Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

What is the concept of Mutual Exclusion?

In computer science, one of the important concepts of the synchronization is the mutual exclusion.
– This concept is all about the requirement of making sure that at the same time there are no two threads or processes in the critical section.
– The critical section is here referred to as that period of time when a shared resource is accessed by the processes like the shared memory.
To make you understand the importance of the mutual exclusion concept we shall take an example of the singly linked list.
– In singly lists in order to remove a node, the next pointer of the previous node has to be changed to the next node that follows.
– In the execution process when the multiple processes share the same linked list, an attempt might be made by the two processes for deleting the two different nodes from the same list that might result in this problem:

– Consider the two nodes to be removed are i+1 and i and also these neither the head nor the tail.
– When the operation takes place the node pointer of i-1 is changed to node i+1 and that of the i node is changed to i+2.
– Even though both the operations take place successfully, you will find that the node i+1 is still there in the list.
– This happened because when the node i-1 was changed to i+1 the node i was skipped.
– This I node was changed to i+2.

– Mutual exclusion comes to a great help regarding this issue since using it makes sure that to the same part simultaneous updates are made.
– For enforcing the mutual exclusion both the hardware and the software solutions are available.
– There is a simple solution for achieving mutual exclusion on the uni-processor systems for disabling the interrupts during the critical section of the process.
– This prevents the execution of the interrupt service routines.
– Thus, in a way prevents the preemption of the process effectively.
– Although the solution is too effective, it can be a cause for many other problems.
– Depending on the length of the critical section, more the system clock drifts after the execution of the critical section takes place.
– Since the servicing is no longer done for the timer interrupt then tracking the time becomes impossible during the execution of the critical section.
– Also, if the execution of a process stops during the critical section, it is almost impossible for returning the control to the other process and thus it is so effective in bringing the whole system to a halt.
– Busy wait is another common and better way for implementing the method of mutual exclusion.
– This methodology has proven to be effective for the multiprocessor as well as uni processor systems.
– Here, the mutual exclusion is provided by the atomic test and set instruction and shared memory.
– In a location in this shared memory, test and set can be done by the process.
– Because of the atomic nature of the operation, the flag can be set only by one process at a time.
– If by chance the process faces failure in setting the flag, it can go for completing the other pending tasks and come back again for this later.
– This process leaves the processor to be used by the other processes.
– Such a process may also continue via loop for setting the flag until it becomes successful in doing so.
– In this case also there are possibilities for preemption, thus allowing the system to go on with its functioning even if another process comes to a halt.
– There are many other atomic operations available for providing the mutual exclusion.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>