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

  • 4
    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? – D.W. Aug 10 at 6:07
  • Just to underline D.W.'s point, one quite good textbook that is available for free: pages.cs.wisc.edu/~remzi/OSTEP – Pseudonym Aug 10 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

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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