Operating System - Priority Scheduling

<<Previous

Next >>





Priority scheduling is scheduling a set of processes each one with a specific priority relative to other processes

There are 2 types of Priority scheduling: Fixed Priority scheduling and Dynamic Priority Scheduling.

In Fixed Priority scheduling, process is assigned a fixed priority at the start.

In Dynamic Priority Scheduling, during execution, the priority is calculated and assigned to process.

  • 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 4095. 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 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
P1113
P221
P334
P415
P552

Gantt Chart:



<<Previous

Next >>









Operating System - Priority Scheduling

<<Previous

Next >>





Priority scheduling is scheduling a set of processes each one with a specific priority relative to other processes

There are 2 types of Priority scheduling: Fixed Priority scheduling and Dynamic Priority Scheduling.

In Fixed Priority scheduling, process is assigned a fixed priority at the start.

In Dynamic Priority Scheduling, during execution, the priority is calculated and assigned to process.

  • 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 4095. 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 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
P1113
P221
P334
P415
P552

Gantt Chart:



<<Previous

Next >>















Learn about Stack Data Structure

Learn about Heap Data Structure

Learn about Operating System

Learn AVL Tree

Learn Djikstra's Algorithm