- We must ensure that the OS maintains control over the CPU. We must prevent a user program from getting stuck in an infinite loop or not calling system services and never returning control to the OS. To accomplish this goal, we can use a timer. A timer can be set to interrupt the computer after a specified period.
- Thus, we can use the timer to prevent a user program from running too long. A simple technique is to initialize a counter with the amount of time that a program is allowed to run.
- When the counter becomes negative, the OS terminates the program for exceeding the assigned time limit.
Cem Ozdogan
2010-02-20