Timer Interrupts
Why does a process move from Running to Ready?
The operating system must meet the two goals of fairness amongst processes
and maximal use of resources (here, the processor and, soon, memory).
The first is easily met: enable each process to execute for a predetermined
period before moving the Running process to the Ready queue.
- A hardware timer will periodically generate an interrupt (say,
every 10 milliseconds). Between the execution of any two instructions,
the processor will "look for" interrupts.
When the timer interrupt occurs,
the processor will begin execution of the interrupt handler.
- The handler will increment and examine the accumulated time of the currently
executing process, and eventually move it from Running to Ready.
- The maximum time a process is permitted to run before changing state
is often termed the
time quantum.
CITS2002 Systems Programming, Lecture 8, p7, 14th August 2024.
|