Bellow 4 processes with their arrival and Burst time are given

advertisement
1.
Consider the following set of processes, with the arrival times and the length of the CPUburst times given in milliseconds,
Process
Arrival Time Burst Time
P1
0.0
7
P2
2.0
4
P3
4.0
1
P4
5.0
4
Draw a Gantt chart illustrating the execution of these processes and Calculate the
average waiting time using the following scheduling algorithms
a. SJF non-preemptive
b. SJF preemptive
Soluction
a) SJF (non-preemptive)
P1
0
P2
3
7
8
P4
12
16
Average waiting time = (0 + 6 + 3 + 7)/4 = 4
b) SFJ preemptive
P1
0
P2
2
P3
4
P2
5
P4
7
P1
11
 Average waiting time = (9 + 1 + 0 +2)/4 = 3
2) Consider the following set of processes, with the length of the CPU-burst times
given in milliseconds
Process
Burst Time
P1
53
P2
17
P3
68
P4
24
16
P3
Draw a Gantt chart illustrating the execution of these processes using the round
robbing algorithm with a time quantum = 20
P1
0
P2
2
0
P3
3
7
P4
5
7
P1
7
7
P3
9
7
P4
11
7
P1
12
1
P3
13
4
P3
15
4
16
2
1. 3) Consider the following set of processes, with the arrival times and the length of
the CPU-burst times given in milliseconds, and the priorities given so that smaller
priority number means a higher priority.
Process
------P1
P2
P3
P4
P5
Arrival time
-----------0
2
3
4
6
Burst time
---------10
1
2
1
5
Priority
-------3
1
3
4
2
Draw a Gantt chart illustrating the execution of these processes using a
preemptive priority scheduling. (Use FCFS for equal priority processes)
Calculate a waiting time and a turnaround time for each process, and an average
waiting time and an average turnaround time for the scheduling
Solution will be discussed in the class
Download