0% found this document useful (0 votes)
22 views3 pages

Operating System

Operating system process scheduling

Uploaded by

Anju Athouse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Operating System

Operating system process scheduling

Uploaded by

Anju Athouse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Problem1

Consider the following set of processes, with arrival times and the CPU-burst times
given in milliseconds.

Process Arrival Time Burst Time


P1 0 5
P2 1 3
P3 2 3
P4 4 1

What is the average turnaround time for these processes with the preemptive
Shortest Remaining Processing Time first (SRTF) algorithm?
Soln: The Gantt Chart for SRTF CPU scheduling algorithm is
P1 P2 P2 P2 P4 P3 P3 P3 P1 P1 P1 P1
0 1 2 3 4 5 6 7 8 9 10 11 12

Turnaround Time of P1 = 12 – 0 = 12
Turnaround Time of P2 = 4 – 1 = 3
Turnaround Time of P3 = 8 – 2 = 6
Turnaround Time of P4 = 5 – 4 = 1

So Average Turnaround Time = (12 + 3 + 6 +1 ) / 4 = 5.50


Problem2
Consider the CPU-intensive processes, which requires 10, 20 and 30 time
units and arrive at time 0, 2, 6 respectively. How many context switches are
needed if the operating system implements a shortest remaining time first
algorithm? Do not count the context switches at time zero and at the end.
Solution:
Process Arrival Time Burst Time
P1 0 10
P2 2 20
P3 6 30

The Gantt Chart for SRTF CPU scheduling algorithm is


P1 P2 P3
Context switches = 2
0 10 20 30

You might also like