- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is mutual exclusion by using interrupt disabling?
Whenever a process is accessing the shared variable then that process is said to be in the critical section. If no two processes are in the same critical section at same time then this technique is called mutual exclusion.
Mutual exclusion problem with assigned priority is shown below −
Let us see the requirements of mutual exclusion and state which of them are met when interrupts are disabled.
Whenever the interrupts are disabled, it effectively stops scheduling other processes. Whenever disabling interrupts, the CPU will be unable to switch processes and processes can use shared variables without another process accessing it.
The most obvious way to achieve mutual exclusion is to allow a process to disable interrupts before it enters critical sections. Uniprocessor refers to the operation being atomic as long as context switches do not occur.
There are basically two ways to control dispatcher which are as follows −
Internal events − Thread does something to relinquish the CPU.
External events − Interrupts can cause dispatchers to take the CPU away.
So, it is needed to prevent internal and external events as follows −
To prevent internal events is easy.
To prevent external events requires disabling interrupts.
Now let us identify the problems associated with the mechanism which are as follows −
Whenever disabling interrupts, the CPU will be unable to switch processes and processes can use shared variables without another process accessing it.
The system clock depends on interrupts so it can drift.
The disabling interrupt does not work well on multiprocessors because the time to disable and enable on all processes is high.
Kickstart Your Career
Get certified by completing the courseGet Started