title: Disabling all interrupts
body: <p>I'm reading Stallings' "Operating Systems Internals and Design Principles", and in the chapter about concurrency and mutual exclusion it reads:</p>
  
  <blockquote>
    <p>In a uniprocessor system, concurrent processes cannot have overlapped
    execution; they can only be interleaved. Furthermore, a process will
    continue to run until it invokes an OS service or until it is
    interrupted.Therefore, to guarantee mutual exclusion, it is sufficient
    to prevent a process from being interrupted. This capability can be
    provided in the form of primitives defined by the OS kernel for
    disabling and enabling interrupts.</p>
  </blockquote>
  
  <p>I've found <a href="https://stackoverflow.com/questions/337903/how-can-you-ensure-in-java-that-a-block-of-code-can-not-be-interrupted-by-any-ot">this post</a> in SO that seems to address this question, but the OP doesn't give specifics about the type of interrupt he wants to stop, and the post is dead without ever getting an accepted answer (besides the OP deleted the profile), so I was hoping to get to the bottom of this here.
  Assuming that I want the CPU fully dedicated to my code (this is only in theory, I know this is <em>very</em> dangereous), how would I be able to achieve this with Java?</p>