O'Reilly logo

Efficient C++ Performance Programming Techniques by David Mayhew, Dov Bulka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Context Switching

What is a context switch and why is it so expensive? A context switch is moving one process (thread) out of a processor and another process into the processor. This involves saving the process' and the processor's state. The process' state needs to be saved so that an accurate record of the process' execution point is maintained. The processor's state needs to be saved so that the processor can be put back into that state when the associated process continues its execution. Processor state is a component of a process' state, but not the whole story.

A process context is an operating system construct, and as such is very OS dependent. It is managed by a structure in the OS that contains the relevant aspects of a process' state, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required