Search code examples
operating-systemdispatcher

Context switching and swapping occur at the same time?


I have a little understanding of CPU dispatcher. When there is an interrupt for IO or something context switching happens to execute some other process. Will swapping also occur (swap in and swap out) during this time? Will the old process be removed from the physical memory and loaded back again? Or does it stay in main memory all the time?

According to this how dispatcher works? I don't see any swapping.


Solution

  • Will swapping also occur (swap in and swap out) during this time?

    Swapin / Swapout and context switch have no direct relation. The page could be removed, if it referenced rarely (see page reclaim).