Operating System - Priority Scheduling


Next >>

  • Each process is assigned a priority. Here the CPU is allocated to the process which has the highest priority.

  • If two processes have an equal priority, then those processes are scheduled in FCFS order.

  • In general, the priority is indicated by number in the range from 0 to 7 or 0 to 4,095. here, we assume that 0 represents high priority.

  • The priority can be calculated based on time limits, memory requirement, number of open files, the ratio from average I/O burst to average CPU burst.

  • It can be either a preemptive or nonpreemptive.

  • In case of Preemptive priority scheduling algorithm, the CPU will be preempted only if the priority of newly arrived process is higher than the currently running process.

  • In case of nonpreemptive priority scheduling algorithm, the newly arrived process will be placed at the head of the ready queue.

  • The main drawback of this scheduling algorithm is indefinite blocking or starvation (this algorithm can leave the low priority processes waiting indefinitely).

For example consider the set of processes that arrive at time 0 and CPU-burst time given in millisecond:

ProcessCPU-Burst TimePriority

Gantt Chart:


Next >>