◄ Wiki / OS
preemption / preemptive
When the OS forcibly pauses a running thread mid-execution to let a different one run.
In preemptive multitasking, threads don't have to voluntarily yield — a timer interrupt lets the scheduler stop one thread at any point and switch to another, giving the illusion that everything runs at once. A thread can be 'preempted in user mode,' meaning it was interrupted while running ordinary application code. This makes scheduling fair but means code can be paused at awkward moments, which is why synchronization matters.
See also
- race / race conditionA bug where the outcome depends on the unpredictable timing of two things happening at once.
- return frameThe saved snapshot of a thread's state that the CPU restores to resume it exactly where it left off.
- prologue / epilogueThe small bookkeeping code the compiler inserts at the start and end of every function to set up and tear down its workspace.
- PID / TIDUnique ID numbers the operating system assigns to each running program (PID) and each thread inside it (TID).
Referenced by
PID / TID · prologue / epilogue · race / race condition · reaper · return frame