Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. Consider the following set of processes, with the arrival times and the lengt

ID: 3599772 • Letter: 3

Question

3. Consider the following set of processes, with the arrival times and the length of the CPU-burst times given in milliseconds and priority Arrival Process Time Burst Time Priority 32 P2 P3 P4 P5 12 28 36 18 4 25 a) Draw a Gantt chart that shows the execution of these processes using the following scheduling algorithms Nonpreemptive Priority Preemptive Priority Preemptive SJF RR with q=8 and q=16 b) Calculate the average waiting time and the average turnaround time for each scheduling above c) Calculate the number of context switches for the processes under RR CPU scheduling

Explanation / Answer

Nonpreemptive Priority

Gantt Chart

0 P1 32 P2 40 P5 65 P3 83 P4 100

Average waiting time = (0 + 32 + 40 + 65 + 83)/5 = 44

Average Turnaround time (32 + 40 + 65 + 83 +100)/5 = 64

Preemptive Priority

Gantt Chart

0 P1 32 P3 50 P4 67 P5 92 P2 100

Average waiting time = ((0-0) + (32-28) + (50-36) + (67-46) + (92-12))/5 = 23.8

Average Turnaround time ((32-0) + (50-28) + (67-36) + (92-46) +(100-12))/5 = 43.8

Preemptive SJF

Gantt Chart

0 P1 12 P2 20 P1 40 P4 57 P3 75 P5 100

Average Waiting Time: ((20-0-12) + (12-12) + (57-28) + (40-36) + (75-46))/5 = 14

Average Turnaround Time: ((40-0) + (20-12) + (75-28) + (57-36) + (100-46))/5 = 34

RR with q=8

Gantt Chart

0 P1 8 P1 16 P2 24 P1 32 P3 40 P4 48 P5 56 P1 64 P3 72 P4 80 P5 88 P3 90 P4 91 P5 99 P5 100

Average Waiting Time = 29.40

Average Turnaround Time = 49.40

RR with q=16

Gantt Chart

0 P1 16 P2 24 P1 40 P3 56 P4 72 P5 88 P3 90 P4 91 P5 100

Average Waiting Time = 24.60

Average Turnaround Time = 44.60

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote