Context Switching
Context switching is the process of storing the state of a process or thread so that it can be restored and resumed later, allowing the operating system to switch the CPU between multiple tasks. In a trading environment, excessive context switching is undesirable because it consumes CPU cycles and increases latency, as the processor must save registers and load new states.
Trading applications are designed to be as efficient as possible, often pinning processes to specific CPU cores to avoid the overhead of switching. By minimizing the number of tasks competing for CPU time, developers ensure that the trading engine remains focused on processing market data and executing orders.
Reducing context switches is a key goal in performance-oriented systems engineering.