.. _scheduler: ####################### The Process Scheduler ####################### We define :term:`process scheduling` as: The act of determining which process in the ready state should be moved to the running state. That is, decide which :term:`process` should run on the CPU next. --------- The **goal** of the scheduler: Implement the :term:`virtual machine` in such a way the user perceives that each process is running on it's own computer. --------- Modern operating systems are generally able to achieve this because of the statistical properties of processes. Over a short period, processes can be categorized according to what is limiting the completion of the process. .. index:: I/O Bound Process .. describe:: I/O Bound Process * Processes that are mostly waiting for the completion of input or output (I/O) are :dfn:`I/O Bound`. * Interactive processes, such as office applications are mostly I/O bound the entire life of the process. Some processes may be I/O bound for only a few short periods of time. * The expected short run time of I/O bound processes means that they will not stay the running the process for very long. * They should be given high priority by the scheduler. .. index:: CPU Bound Process .. describe:: CPU Bound Process * :dfn:`CPU Bound` processes are ones that are implementing algorithms with a large number of calculations. * They can be expected to hold the CPU for as long as the scheduler will allow. * Programs such as simulations may be CPU bound for most of the life of the process. * Users do not typically expect an immediate response from the computer when running CPU bound programs. * They should be given a lower priority by the scheduler. --------- Schedulers fall into one of two general categories: 1. .. describe:: Non-preemptive scheduling when the currently executing process gives up the CPU voluntarily. 2. .. describe:: Preemptive scheduling when the operating system decides to favor another process, preempting the currently executing process. --------- **Contents** .. toctree:: :maxdepth: 2 sched_parts metrics fcfs sjn rr priority_queues