Context switching
Context switching is an unfortunate reality on the OS—it's meta-work that must be done every time the OS switches from running one process to running another process (we have voluntary and involuntary context switches). The actual amount of time it takes to context switch is highly dependent on the hardware system and the software quality of the OS; typically, though, it's in the region of tens of microseconds for x86-based hardware systems. That sounds quite tiny: to get an idea of why this is considered important (and indeed wasteful), look at the output of running vmstat 3 on an average Linux desktop computer (vmstat(1) is a famous utility; used this way, it gives us a nice 10,000-foot view of system activity; hey, also ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access