# Context Switch and Following Scheduling Algorithms

Topics: Context switch, Scheduling, Scheduling algorithms Pages: 3 (351 words) Published: April 12, 2014
﻿TMC1234/TMC1233: Operating System
Session 2013/2014 Semester 2
TUTORIAL 4

1. Which scheduling policy is most suitable for time-shared operating systems? (a) Shortest Job First
(b) Round Robin
(c) First Come First Serve
(d) Elevator

What information about a job needs to be kept in process control block?

2. What information about a process needs to be saved, changed or updated when context switching takes place?

3. Five jobs are in the READY queue waiting to be processed. Their estimated CPU cycles are as follows: 10,3,5,6 and 2. Using SJN, in what order should they be processed to minimize average waiting time?

4. Assume that the following jobs are to be executed on a single processor system:

Job ID
CPU Cycle
p
4
q
1
r
8
s
1
t
2

The jobs are assumed to have arrived at time 0 and in the order p, q, r, s, t. Calculate the departure time (completion time) for job p if scheduling used is the Round Robin with time quantum of 1. Is it (a) 4(b) 10 (c) 11 or (d) 12

5. Given the following information:

Job Number
Arrival Time
CPU Cycle
A
0
10
B
2
12
C
3
3
D
6
1
E
9
15

Draw a timeline for each of the following scheduling algorithm. (It may be helpful to first compute to first compute a start and finish time for each job). a. FCFS
b. SJN
c. SRT
d. Round Robin (using a time quantum of 5, ignore context switching and natural wait) 6. Using the same information given for question 5, complete the chart by computing waiting time and turnaround time for each of the following scheduling algorithms (Ignoring context switching overhead).

a. FCFS
b. SJN
c. SRT
d. Round Robin (using a time quantum of 5)

7. Using the same information given for question 5, complete the chart by computing average waiting time and average turnaround time for each of the following scheduling algorithms and determine which one gives the best result .

8. Consider three CPU-intensive...

Please join StudyMode to read the full document