PS (Priority Scheduling)



Objective:
To implement ‘Priority scheduling algorithm’.
Theory:
Priority scheduling is a non-preemptive algorithm and one of the most popular scheduling algorithms. Each process is assigned a priority. Process with highest priority is to be executed first and so on. Processes with same priority are executed on first come first served basis.
Example:
Process
Burst Time
Priority
P1
10
3
P2
1
1
P3
2
4
P4
1
5
P5
5
2
The Gantt chart for the schedule is:
Average waiting time=8.2
Algorithm:
1.      Declare the array size and the number of elements to be inserted.
2.      Get the priority for each process and value
3.      Start with the higher priority process, let other process to be queue.
(smallest integer = highest priority)
4.      Calculate and display the values of  waiting time of each process and average waiting time.
Task:
Write a C++ code/shell script to implement Priority scheduling algorithm.

Post a Comment

0 Comments