Question: Do the code in the C++ programming language. 4b. Priority Scheduling Priority scheduling is one of the most common scheduling algorithms in batch systems. Each

 Do the code in the C++ programming language. 4b. Priority Scheduling

Priority scheduling is one of the most common scheduling algorithms in batch

Do the code in the C++ programming language.

4b. Priority Scheduling Priority scheduling is one of the most common scheduling algorithms in batch systems. Each process is assigned a priority. Process with the highest priority is to be executed first and so on. Processes with the same priority are executed on first come first served basis. If used as a pre-emptive version, a running process having lower priority will be sent back to the ready queue if a process with higher priority arrives in the queue. Process Arrival Time CPU Time Priority P1 4 5 0 P2 0 7 2 P3 2 9 1 Gantt chart: (Pre-emptive Version) -------P2---------------3-- --------P1.----------------- -P2----- 0 2 4 9 16 21 Waiting Time Turnaround Time P1 4-4= 0 0+5=5 P2 0 + 16-2 = 14 14+7=21 P3 2-2 +9-4 = 5 5+9=14 Average Waiting Time: (0+14+5)/3 = 6.33 Average Turnaround Time: (5+21+14)/3 = 13.33

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!