5.1 Basic concepts


CPU is the most important computer resources. One of the main goals of the operating system is to maximize the CPU utilization. In multiprogramming, when one process has to wait then another process has to use CPU. CPU scheduling is to decide when each process will be able to use CPU. CPU scheduling is central to operating-system design. CPU scheduling depends on the property that each process has two states which are CPU execution and I/O wait.

CPU scheduling decisions are taken in one of the following four:
When a process switches from the running state to the waiting state.
When a process switches from the running state to the ready state.
When a process switches from the waiting state to the ready state.
When a process terminates

CPU scheduling can be done in one of the following schemes:
Nonpreemptive scheduling: When a process uses CPU, it does not release CPU until it terminates or
switches to the wait state.
Preemptive scheduling: The operating system can force the process to release CPU and switch it to the
ready queue.

5.1 Basic concepts


The dispatcher is the module that gives control of the CPU to the process selected by the CPU scheduler. This dispatcher performs the following:
Switching context.
Switching to user mode.
Jumping to the proper location in the user program to restart that program.