Assume a process execution interrupted at the middle and CPU started executing a different process.How does the OS handle this situation?

  • 4
    $\begingroup$ This is described in many operating system textbooks. There would be little point in us repeating information that's already available in standard resources. We expect you to do a significant amount of study/research before asking here. Have you already done that? Can you edit your question to tell us what you've been reading, what you already understand, and what specifically you are unsure about? $\endgroup$ – D.W. Aug 10 '18 at 6:07
  • $\begingroup$ Just to underline D.W.'s point, one quite good textbook that is available for free: pages.cs.wisc.edu/~remzi/OSTEP $\endgroup$ – Pseudonym Aug 10 '18 at 8:09

The way you worded the question, it sounds like the CPU starts executing a different process, and the operating system must react to this. But this is not how it works.

There are two ways to switch between processes. Both involve the operating system. One way is if the process calls the operating system. The other way is if an interrupt happens; in this case the CPU invokes an interrupt handler which is part of the operating system. In both cases, the operating system may take the decision to either return to the previous process, or to switch to a different process.


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.