Priority Based Process Scheduling in operating systems

Priority Based Process Scheduling in operating systems.

Priority scheduling is a preemptive algorithm so processes priority matters.

Each process has a priority number.

The process with high priority always gets the CPU on a priority basis.

Processes with the same priority are executed according to the first come first served(FCFS)scheduling algorithm.

Preferred in batch systems.

Process Burst Time Priority
P1 4 2nd
P2 2 3rd
P3 8 1st
P4 3 4th

Gantt Chart of Preemptive Scheduling

Let us see the Gantt Chart of Preemptive Scheduling.

Preemptive scheduling Diagram

Process Waiting Time
P1 8
P2 12
P3 0
P4 14

Average Wait Time: (0+8+12+14) / 4 = 8.5

Priority Based Process Scheduling Program in C++ (C Plus Plus)

Output

Priority Based Process Scheduling in operating systems

Priority scheduling using friend class and friend function

Let us see the Priority scheduling using friend class and friend function.

Video Lecture