What's the difference between a context switch, a process switch and a thread switch in Linux?

Context Switching involves storing the context or state of a process or thread so that it can be reloaded when required and execution can be

resumed from the same point as earlier. This is a feature of a multitasking operating system and allows a single CPU to be shared by multiple processes.

A process switch or process scheduling is to changing one process from another by saving all of the state of the currently executing process, including its register state, associated kernel state, and all of its virtual memory configuration.

A thread switch means switching from one thread to another thread within a process.

The main difference between process switch and thread switch is that virtual address space is remaining same and thus have same content in the cache is case of thread switch.so there is no need to invalidate the TLB. But this is not happened in case of process switch as virtual address space is not remain same. So we must invalidate the TLB cache.

Thus the cost for switching between processes is much more than switching between threads.

Updated on: 11-Oct-2019


Kickstart Your Career

Get certified by completing the course

Get Started