What is context switching in OS?

Every process has a context associated with it. This context includes all the information needed to completely describe the process’s current state of execution – like the contents of the CPU registers, the flags, the program counter, etc.

What happens during a context switch?

When a context switch occurs, the context of the currently running process is saved, and whichever process is ready to run next has its context restored. This is decided by scheduling policies. Any multitasking operating system has context switching as an essential feature.





Follow Varoon Sahgal, author, on Google Plus