Context switching is when the CPU switches from one thread/process to another. It’s expensive because the OS must save/restore registers, switch memory mappings, and flush caches/TLBs.
Switching work adds overhead and disrupts locality:
High thread count scenario:
1000 runnable threads -> frequent switches -> lower cache hit rate -> slower throughput