2
$\begingroup$

Assume I have a multicore system and a critical section.

I understand how disableling interrupts on a single core systems solves the critical section problem.

So assume I could disable interrupts on all cores atomically (Why is that not possible?). Why would that solve the problem?

As I understand, there would still be n processes running at the same time that may interfere with each other. They just wont be stopped until interrupts are enabled again.

Can somebody explain why that would (according to my professor) work?

$\endgroup$
  • $\begingroup$ What specifically is your confusion? What makes you uncertain about whether it would solve the problem? It's hard to know how to explain without some sense of your confusion. Can you try writing out why it solves the problem on a single core system, and what you're unsure about on a multicore system? Try to write out a scenario of what you think could go wrong. Also, the idea of disabling interrupts is discussed in standard textbooks; have you read any? $\endgroup$ – D.W. Mar 11 '15 at 16:15
  • $\begingroup$ Last advice: I suggest asking just one question (e.g., why would that solve the problem?) at a time, and leaving the "why isn't that possible?" to a separate question. $\endgroup$ – D.W. Mar 11 '15 at 16:16
1
$\begingroup$

We are generally concerned about controlling concurrent access to kernel data structures. User-level processes don't have access to kernel data structures, so they can't do any harm from user space. The only risks are (1) if a user process does a syscall or causes a context switch to kernel mode, (2) if an interrupt arrives. (1) could be guarded by explicitly checking for a lock, or by other methods. (2) could be guarded by disabling interrupts, if you had a way to disable them on all cores.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.