Disabling Interrupt for Mutual Exclusion

Q1. Explain Disabling Interrupt for mutual exclusion and also mention its disadvantages.

Ans. Solution is to have each process disable all interrupts just after entering its critical region and re-enable them just before leaving it. With interrupts disabled, no clock interrupts can occur. The CPU is only switched from process to process as a result of clock or other interrupts, after all, and with interrupts turned off the CPU will not be switched to another process. This, once a process has disabled interrupts, it can examine and update the shared memory without fear that any other process will intervene.

Disadvantage

This approach is generally unattractive because it is unwise to give user processes the power to turn off interrupts. Suppose that one of them did it, and never turned them on again? That could be the end of the system. Furthermore, if the system is a multiprocessor disabling interrupts affects only the disabled instruction. The other ones will continue running and can access the shared memory.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: