Context Switch

0 views - 1 minute readEdit this post

I rely on your support to keep this website running. If you find the content valuable, please consider making a small donation. whether it’s ₹25/$1 or ₹500/$5.


Secured by Stripe

Context Switch

  • Context switching is method or technique of storing the state of current program and executing another program, and restoring the previous program from the same state when it was switched.

  • Basically it is method of storing current state of program so that it can be restored and later, and then loading the state of another process and run it.


  • Here is how it works,

    • assume there are two process running p1 and p2, we first save the current state of p1 in the memory and then load the p2 then we can save the state of p2 and reload the state of p1.
    • In simpler words it switching between processes without losing their state.
  • Triggers for Context Switching,

    • Multitasking
    • interrupt handling
    • user and kernel mode switch

Did you enjoyed the post?

Twitter (x)