What actually happens during a context switch, and why should an application developer care?
A context switch saves the running thread's registers and program counter, lets the kernel scheduler choose another runnable thread, and restores that thread's state; the dominant cost is usually the cache and TLB pollution afterwards rather than the save and restore itself.