Understanding the cost of process vs thread context switches
This is a medium-difficulty operating systems question that tests whether you grasp the architectural differences between processes and threads, and how those differences translate into real performance costs. It's the kind of conceptual question quant shops ask to verify that candidates understand system-level tradeoffs, not just language-level abstractions.
To answer well, you need to reason about what the CPU and kernel actually do during a context switch: which memory structures must be saved and restored, which caches are invalidated, and which isolation guarantees must be enforced. The key is understanding why processes and threads carry different overheads, and being able to articulate the scenario where each matters most.
- Virtual memory and address space management
- Translation lookaside buffer (TLB) invalidation
- Kernel state vs user state in process and thread descriptors
- Cache coherency and context pollution