You are on page 1of 4

TUTORIAL 02 – SCHEDULING ALGORITHM

SUBJECT : BIT2CC063 Operating System


SUBJECT LECTURER : Ms. Athirah
STUDENT NAME :
STUDENT ID :

QUESTION

1. Processes A, B and C arrive in that order. A has priority 3 and requires 8 quanta, B
has priority 1 and takes 10 quanta and C has priority 3 and requires 6 quanta.
Calculate the average Waiting Time and Turn Around Time if the scheduling
mechanism used is:
(a) FCFS
(b) SJF
(c) RR
(d) PQ

Assume that the time for a context switch can be ignored.

2. Processes W, X, Y and Z arrive in that order. W has priority 1 and requires 7 quanta,
X has priority 3 and takes 9 quanta, Y has priority 2 and requires 5 quanta and Z has
priority 3 and requires 6 quanta. Calculate the Average Waiting Time and Turn
Around Time if the scheduling mechanism used is:
(a) FCFS
(b) SJF
(c) RR
(d) PQ

Assume that the time for a context switch can be ignored.

3. Processes P, Q, R, S and T arrive in that order. P has priority 2 and requires 6


quanta, Q has priority 3 and takes 8 quanta, R has priority 1 and requires 3 quanta, S
has priority 1 and requires 7 quanta and T has priority 2 and requires 6 quanta.
Calculate the Average Waiting Time and Turn Around Time if the scheduling
mechanism used is:
(a) FCFS
(b) SJF
(c) RR
(d) PQ

Assume that the time for a context switch can be ignored.


4. An operating system has two process priority levels, 1 and 2. Three new processes,
X, Y and Z arrive at the same time in that order with the following characteristics:

Process X Y Z
Quanta Required 4 8 10
Priority 1 2 1

Calculate the Average Waiting Time and Average Turn-Around Time if:
(a) normal Round Robin scheduling is used.
(b) modified Round Robin scheduling which gives priority 1 processes a
double quantum and priority 2 processes a single quantum whenever they
are scheduled.

Assume that the time for a context switch can be ignored.

5. An operating system has two process priority levels, 1 and 2. Three new processes,
A, B and C, arrive at the same time in that order with the following characteristics:

Process A B C
Quanta Required 20 30 40
Priority 1 1 2

Calculate the Average Waiting Time and Average Turn-Around Time if:
(a) normal Round Robin scheduling is used.
(b) modified Round Robin scheduling which gives priority 1 processes a
double quantum and priority 2 processes a single quantum whenever they
are scheduled.
(c) What advantages or disadvantages has the algorithms described in (b)
compared to Priority Queue (PQ) scheduling?

Assume that the time for a context switch can be ignored.

6. An operating system has two process priority levels, 1 and 2. Four new processes, A,
B, C and D arrive at the same time in that order with the following characteristics:

Process A B C D
Quanta Required 6 9 12 15
Priority 1 2 1 2

Calculate the Average Waiting Time and Average Turn-Around Time if:
(a) normal Round Robin scheduling is used.
(b) modified Round Robin scheduling which gives priority 1 processes a triple
quantum and priority 2 processes a single quantum whenever they are
scheduled.

Assume that the time for a context switch can be ignored.


7. An operating system has two process priority levels, 1 and 2. Three new processes,
P, Q and R arrive at the same time in that order with the following characteristics:

Process P Q R
Quanta Required 24 6 12
Priority 1 2 2

Calculate the Average Waiting Time and Average Turn-Around Time if:

(a) normal Round Robin scheduling is used.


(b) modified Round Robin scheduling which gives priority 1 processes a triple
quantum and priority 2 processes a double quantum whenever they are
scheduled.

Assume that the time for a context switch can be ignored.

8. Suppose that the following processes arrive for execution at the times indicated.
Each process will run for the amount of time listed. In answering the questions, use
non-preemptive scheduling and base all decision on the information you have at the
time the decision must be made:

Process Arrival time Burst time


P1 0.6 8
P2 0.4 4
P3 1.0 1
P4 0.2 3

(a) What is the average turnaround time for these processes with the FCFS
scheduling algorithm?

(b) What is the average turnaround time for these processes with the SJF
scheduling algorithm?

9. Consider the following set of processes, with the length of the CPU burst given in
millisecond:

Process Burst time Priority


P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5 all at time 0.
(a) Draw four Gantt charts that illustrate the execution of these processes
using the following scheduling algorithms: FCFS, SJF, non-preemptive
priority (smaller priority number implies a high priority) and RR
(quantum =1).

(b) What is the turnaround time of each process for each of the scheduling
algorithms in part (a)?

(c) What is the waiting time of each process for each of these scheduling
algorithms?

(d) Which of the algorithms results in the minimum average waiting time
(over all processes)?

You might also like