Consider the table of process shown below The arrival time c

Consider the table of process shown below. The arrival time column indicates the time at which each process is inserted into the ready queue. The priority column indicates the priority of each process, with smaller values indicating higher priority. The CPU burst column indicates the amount of CPU time that each process requires.

Process ID

a) Create a Gantt chart showing how these processes would be scheduled by a preemptive priority based scheduler. Be sure to indicate the time at which each context switch occurs on your Gantt chart. For the purposes of this question you can ignore the overhead for context switches (context switch time = 0).

b) What is the average turnaround time.

c) What is the average wait time.

Process ID

Arrival Time Priority CPU Burst
0 0 3 20
1 5 2 15
2 10 5 10
3 25 1 20
4 40 4 10

Solution

PRE-EMPTIVE PRIORITY SCHEDULING

Gantt Chart

0                  5                  20              25                 45                55                65              75

Average turnaround time = ((55-0)+(20-5)+(75-10)+(45-25)+(65-40))/5 = (55+15+65+20+25)/5 = 180/5 = 36 ms

Average waiting time = ((45-0)+(5-5) +(65-10)+(25-25)+(55-40))/5 = (45+0+55+0+15)/5 = 115/5 = 23 ms

ROUND ROBIN Quantum =5

0       5     10     15      20    25     30    35    40     45     50    55    60    65      70   75

Average turnaround time = ((60-0)+(50-5)+(35-10)+(75-25)+(65-40))/5 = 205/5 = 41 ms

Average waiting time = ((55-0)+(45-5)+(30-10)+(70-25)+(60-40))/5 = 36 ms

P0 P1 P0 P3 P0 P4 P2
Consider the table of process shown below. The arrival time column indicates the time at which each process is inserted into the ready queue. The priority colum

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site