Scheduling Algorithms

  1. Priority Scheduling.
    • In this algorithm, every process is assigned a priority, which is usually given as a number. In the example that follows on the next slide, the smallest the number, the greater the priority is, and the earlier the process will run on the CPU.
    • Priority Scheduling is a generalization of SJF: in SJF, the priority is the inverse (1/x) of the burst time. That is, the shorter the burst time is, the greater the priority of the process is.
    • Advantage: Processes with the greatest priorities (those we need the most) will get to run first.
    • Disadvantage: A process with a small priority might never have a chance to run since new processes with greater priorities will keep arriving at the ready queue. This phenomenon is known as indefinite blocking or starvation.
    • To address this, we could apply the solution of aging, in which we "bump" the priority of processes based on how much they wait. That is, processes that got to wait too much time will have their priorities gradually increased, and therefore will eventually be guaranteed to run on the CPU.