Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Assignment 2

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

Riphah International University, Lahore Campus, Pakistan

Riphah School of Computing & Innovation


Operating Systems – Fall 2022

ASSIGNMENT 2

Q1. What advantage is there in having different time-quantum sizes at different levels of a
multilevel queueing system?

Q2. Suppose that a CPU scheduling algorithm favors those processes that have used the least
processor time in the recent past. Why will this algorithm favor I/O-bound programs and yet not
permanently starve CPU-bound programs?

Q3. Suppose that the following processes arrive for execution at the times indicated. Schedule
these process as per given algorithms and show the results by drawing Gantt charts and
calculating the average waiting time for the following scheduling algorithms?
a. Time quantum for Round Robin and Priority scheduling is 3ns.

Process ID Arrival Time (ns) Priority Burst Time (ns)


0 0 Medium 8
1 5 Low 3
2 7 Very High 7
3 10 Low 4
4 13 High 7

a) First come first serve scheduling


b) Shortest Job First (preemptive) Scheduling
c) Round Robin Scheduling (preemptive)
d) Priority Scheduling (preemptive)

Q4. The following processes are being scheduled using a preemptive, round robin scheduling
algorithm. Each process is assigned a numerical priority, with a higher number indicating
a higher relative priority. In addition to the processes listed below, the system also has an
idle task (which consumes no CPU resources and is identified as Pidle ). This task has
priority 0 and is scheduled whenever the system has no other available processes to run.
The length of a time quantum is 10 units. If a process is preempted by a higher-priority
process, the preempted process is placed at the end of the queue.
Process Priority Arrival Time Burst Time
P1 3 0 5
P2 1 3 9
P3 2 6 2
P4 1 8 7
P5 3 9 4

a. Show the scheduling order of the processes using a Gantt chart.


b. What is the turnaround time for each process?
c. What is the average waiting time for each process?
d. What is the CPU utilization rate?

Q5. Five batch jobs, A through E, arrive at a computer center at essentially the same time.
They have an estimated running time of 15, 9, 3, 6, and 12 minutes, respectively. Their
(externally defined) priorities are 6, 3, 7, 9, and 4, respectively, with a lower value corresponding
to a higher priority. For each of the following scheduling algorithms, determine the turnaround
time for each process and the average turnaround for all jobs. Ignore process switching overhead.
Explain how you arrived at your answers. In the last Three cases, assume only one job at a time
runs until it finishes, and all jobs are completely Processor bound.
a. round robin with a time quantum of 1 minute
b. priority scheduling
c. FCFS (run in order 15, 9, 3, 6, and 12)
d. shortest job first

You might also like