Time slice multiplexing
Time slice multiplexing is a form of preemptive
multitasking in which the system periodically suspends execution of one thread and begins execution of another thread. This is accomplished using hardware timers and interrupts present on most modern processors. On
Intel machines this is usually keyed to the Non-Maskeable Interrupt (NMI) INT0. When the timer expires it causes an exception, which forces the processor to push the processor state to the stack and begin executing the instructions pointed to by the interrupt vector table entry for INT0. This usually points to the
kernel, which then switches the stack pointer to point to the stack fo the next thread to be executed and executes an IRET, or return from interrupt. The IRET causes the processor to pop the processor status from the stack and resume execution.