Scheduling in Action

In order to execute user programs, an operating system must relinquish control of the CPU to the user program. Most modern operating systems, OpenVMS included, contain a mechanism to ensure that the operating system can regain control of the CPU from a user process.

This mechanism is implemented as an interrupt, an event that causes the CPU to suspend its normal operation and perform a small piece of software known as a service routine. Some interrupts are generated at regular intervals by timers in the computer hardware. Others are generated by hardware or software in response to various conditions.

By using a combination of hardware and software interrupts, OpenVMS gains control of a CPU at frequent intervals (several times per second) and determines whether the current process should be removed from execution in favor of another one. It is normal for a CPU to switch among various processes many times per second. This is what gives the appearance of many processes proceeding at once.

Processes waiting for CPU service are in COM state and are organized into queues according to their priorities. If a process at a higher priority is ready to run, the current process is placed at the end of the COM queue for its own priority, and the new process is loaded.

If an equal-priority process is waiting, OpenVMS may not switch to it immediately. Instead, the current process may be allowed to continue until it has used an adjustable time limit called QUANTUM.

Processes may also be removed from execution as a result of their own actions. A process may need to wait for the completion of an I/O operation, or it may make a reference to a memory address not currently in physical memory. When a process reaches a point at which it cannot continue, OpenVMS places it into the appropriate wait state and selects another process.

Furthermore, if a higher-priority process becomes computable, the current process can be immediately preempted in favor of the new process. This can happen as the result of an interrupt. Let's say a process initiates a disk I/O operation and then enters LEF state while waiting. Another process is executed during the wait. When the disk I/O is finished, an interrupt is generated. In response to the interrupt, the CPU executes the appropriate service routine, which makes the original process ready. The original process may have a higher priority than the current process (see "Process Priorities," next), in which case the current process is immediately preempted.



Getting Started with OpenVMS(c) A Guide for New Users
Getting Started with OpenVMS: A Guide for New Users (HP Technologies)
ISBN: 1555582796
EAN: 2147483647
Year: 2005
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net