Because PendSV is set to the lowest exception priority, which guarantees the context switch happens only after every other pending interrupt has completed, you never switch tasks in the middle of servicing a higher-priority ISR, which would be unsafe and would add latency to that interrupt. SysTick (and other ISRs) just request a switch by setting PendSV pending; the core then tail-chains into PendSV once all higher-priority handlers have finished, and PendSV does the actual register save/restore. This decoupling matters for two reasons. First, correctness and latency: an interrupt that unblocks a high-priority task can request a switch, but the switch is deferred until the interrupt (and any nested ones) return, so interrupt servicing isn't delayed by the switch and the switch isn't interleaved with interrupt code. Second, it provides a single, well-defined place where switches occur regardless of what triggered them (the tick or any ISR), simplifying the port. The flip side is that task-switch latency includes any in-flight interrupt time, which is one more reason to keep ISRs short.
RTOS & Real-Time Concepts · Interview question
Why does FreeRTOS (on Cortex-M) perform the switch in PendSV rather than directly in SysTick?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Context Switching
How the kernel pauses one task and resumes another: saving and restoring CPU registers to each task's own stack, on Cortex-M via PendSV, PSP/MSP, and hardware auto-stacking.