Cooperative multitasking is a comfortable lie: tasks yield when they feel like it, and one misbehaving loop freezes the machine. Preemption means the kernel takes control whether the task likes it or not, and that starts with a timer interrupt.
Ridge programs the local APIC timer to fire periodically. The interrupt handler saves the full register state of the running task onto its kernel stack, picks the next runnable task, and restores its state — a context switch written in a short, careful stretch of assembly.
The subtlety is everything around that switch: masking interrupts at the right moments, keeping per-CPU state consistent, and making sure the very first switch into a brand-new task lands at a valid entry point with a sane stack.
The first time two user processes printed interleaved output, each unaware of the other, felt like the moment the OS stopped being a program and became an operating system.