COMSATS Institute of Information Technology, Islamabad Assignment 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

COMSATS Institute of Information Technology, Islamabad

Assignment 2
Due Date: 08/11/2018

No marks will be given in case of cheating or copying from the internet or from other students.

---------------------------------- All the questions are mapped to CLO2 ----------------------------------

Q1. What 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 pre-emptive scheduling, and base all decisions on the information you have at the
time the decision must be made.

Process Arrival Time Burst Time


P1 0.0 8
P2 0.4 4
P3 1.0 1

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?
c) The SJF algorithm is supposed to improve performance, but notice that we chose to
run process P1 at time 0 because we did not know that two shorter processes would
arrive soon. Compute what the average turnaround time will be if the CPU is left idle
for the first 1 unit and then SJF scheduling is used. Remember that processes P1 and
P2 are waiting during this idle time, so their waiting time may increase. This
algorithm could be known as future-knowledge scheduling.

Q2. Many CPU-scheduling algorithms are parameterized. For example, the RR algorithm
requires a parameter to indicate the time slice. Multilevel feedback queues require
parameters to define the number of queues, the scheduling algorithms for each queue,
the criteria used to move processes between queues, and so on.

These algorithms are thus really sets of algorithms (for example, the set of RR
algorithms for all time slices, and so on). One set of algorithms may include another (for
example, the FCFS algorithm is the RR algorithm with an infinite time quantum).What
(if any) relation holds between the following pairs of algorithm sets?

a) Priority and SJF


b) b. Multilevel feedback queues and FCFS
c) c. Priority and FCFS
d) d. RR and SJF
Q3. Consider the following set of processes, with the length of the CPU burst given in
milliseconds:

Process Burst Time Priority


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

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 pre-emptive priority (a larger priority
number implies a higher priority), and RR (quantum = 2).
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)?

Q4. Consider a system running ten I/O-bound tasks and one CPU-bound task. Assume that
the I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing
and that each I/O operation takes 10 milliseconds to complete. Also assume that the
context switching overhead is 0.1millisecond and that all processes are long-running
tasks. What is the CPU utilization for a round-robin scheduler when:

a) The time quantum is 1 millisecond


b) The time quantum is 10 milliseconds

You might also like