You are on page 1of 8

OS Assignment # 3

Question 1:
Apply SJF (both Preemptive and non-Preemptive version) and also draw Gantt chat for both,
calculate complete time turnaround time, wait time, response time. Average turnaround time and
average wait time for each process and system. Also defend the difference between the values for
different version of SJF algorithms.

Answer:

****(NON PRE-EMPTIVE)****

****(PRE-EMPTIVE)****
Here, the pre-emptive algorithm is has lower average scores than the non pre-emptive one because pre-
emption allows all of the processes to quickly share CPU and thus the processes have to wait (on average) a
little less than the non pre-emptive way. It can be seen that most of the processes have 0 response time as
compared to the non-preemptive algorithm and this allows the processes to balance out.

******************************************************************************************

Question 2:

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
P No BT Priority
a) P1 10 3
b) P2 1 1
c) P3 2 3
d) P4 1 4
e) P5 5 2

For each of the scheduling algorithms, FCFS, Priority and RR quantum =1 and RR quantum =4.
a) Draw Gantt chart
Answer:

****(FCFS)****

****(Priority Algorithm)****

****(Round Robin where q = 4)****

****(Round Robin where q =


1)****

************

b) Calculate average TAT and Wait Time.


Answer:
****(FCFS)****

****(Priority Algorithm)****

****(Round Robin where q = 4)****


****(Round Robin where q = 1)****

************

c) Also Identify which of these scheduling algorithm gives the smallest average waiting time?

Answer:

Here, the Round robin where q=1 gives the smallest average waiting time because of frequent equal
switching between the processes.

Question 3:

Consider the following set of processes with the indicated arrival time. The length of the CPU – burst time is
given in millisecond.

Process AT Burst Time


P1 0 12
P2 2 9
P3 4 1
P4 6 5
P5 10 3

For each of the following scheduling algorithms, draw the Gantt chart and compute the average waiting
time of these processes execution.
SJF, RR scheduling with q = 3 ms , and Multi – level feedback queue scheduling (Assume both of the first
and second levels use the RR scheduling with quantum sizes as shown in figure 1 x). (Hint: If not served
move to next)

Answer:

****(SJF PRE EMPTIVE)****


****(Round Robin with q = 3)****

****(Multilevel feedback queue)****

(RR with q = 3)
(RR with q = 6)

(FCFS)

NOT USED

(OVERALL)

You might also like