I know about how the kernel slices the CPU time to its processes, but how does it actually hand over control and take it back and what happens to taking control back when the process crashes?

  • a hardware interrupt transfers control from the running process to the scheduler
    – jsotola
    Jan 9 at 19:36

1 Answer 1


Typically no process gets full control to begin with, that's the point of an operating system. That is also why operating systems are by very nature "slower" in running everything.

For details on the software site look into process priority handling in the kernel.

For the hardware side processor architecture and microcode.

Modern PC hardware is very complex basically each component contains an entire slightly less complex computer. The notable exception being RAM it's computer is also now in the CPU package. It used to be on the mainboard. See "north bridge".

Overly simplified:
The CPU is instructed to always hand back control to the OS in defined cycles. The process has no say in this. This is pre-defined behavior of the CPU
Assembler also has a system similar to exception handling in Java or C#.

Similar question with a good overlapping answer:
How does Linux retain control of the CPU on a single-core machine?

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.