0

this is related to mutual exclusion in operating systems, when we have a multiprocessor archicture the solution is to combine disabling interruptions and special instructions like test and set , but if we are able to disable interruptions from all processors when a process take over the critical section i think the mutual exclusion will happen.

i tried researching for answers to this question but i didn't find any usefull resources but i think that there is a way for that to happen.

  • 1
    Not efficiently, no. Normally you use locks to get mutual exclusion ([How does a Mutex work? Does a mutex protect variables globally? Does the scope in which it is defined matter?](https://stackoverflow.com/a/74440124)), not disabling interrupts, except in some uniprocessor systems when the critical section will be short. Also, it wouldn't even help to disable interrupts on other cores, if the code they already happen to be running will touch your shared variables. – Peter Cordes Nov 15 '22 at 08:47
  • 1
    Interrupts are not really that related to mutual exclusion, they are just a complication. If you set up two or more cores to execute the same piece of code competing for a lock, they will compete regardless of the presence of the interrupts. You can easily disable all interrupts on all cores by sending IPIs to make them do so, or you could disable the interrupts at the source, but it won't help. – Margaret Bloom Nov 16 '22 at 08:43
  • @MargaretBloom thank you, there is a solution for mutex by disabling interrupts although it is not used in practice, but i wanted to know if we could use it when we have multiple processors – abdelkhalek beraoud Dec 20 '22 at 16:13

0 Answers0