0% found this document useful (0 votes)
843 views2 pages

CPU Scheduling Exercise With Solution

The document describes 5 scheduling algorithms - First Come First Served (FCFS), Shortest Job First (SJF), Non-Preemptive Priority, and Round Robin (RR). It provides sample data for 5 processes with different burst times and priorities. For each algorithm, it calculates the average wait time and turnaround time. The Shortest Job First algorithm provides the shortest average wait time of 6.6ms and shortest average turnaround time of 12ms.

Uploaded by

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

CPU Scheduling Exercise With Solution

The document describes 5 scheduling algorithms - First Come First Served (FCFS), Shortest Job First (SJF), Non-Preemptive Priority, and Round Robin (RR). It provides sample data for 5 processes with different burst times and priorities. For each algorithm, it calculates the average wait time and turnaround time. The Shortest Job First algorithm provides the shortest average wait time of 6.6ms and shortest average turnaround time of 12ms.

Uploaded by

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

CPU Scheduling Exercises

Problem 1
Solutions

Process   Burst  Priority 


P1   8  4 
P2   6  1 
P3   1  2 
P4   9  2 
P5   3  3 
 

First Come First Served
0 8 14 15 24 27
P1 P2 P3 P4 P5

Avg. Wait = 0+8+14+15+24 = 61/5 = 12.2ms     Avg. TAT = 8+14+15+24+27 = 17.6ms

Shortest Job First

0 1 4 10 18 27
P3 P5 P2 P1 P4

Avg. Wait = 0+1+4+10+18 = 33/5 = 6.6ms  Avg. TAT = 1+4+10+18+27 = 60/5 = 12ms
Non‐Preemptive Priority

0 6 7 16 19 27
P2 P3 P4 P5 P1

Avg. Wait Time = 0+6+7+16+19 = 48/5 = 9.6ms    Avg TAT = 6+7+16+19+27 = 75/5 = 15ms

Round Robin (1ms Quantum)

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
P1 P2 P3 P4 P5 P1 P2 P4 P5 P1 P2 P4 P5 P1 P2 P4 P1 P2 P4 P1 P2 P4 P1 P4 P1 P4 P4

Wait Time P1 = 0+5‐1+9‐6+13‐10+16‐14+19‐17+22‐20+24‐23 = 0+4+3+3+2+2+2+1 = 17
Wait Time P2 = 1+6‐2+10‐7+14‐11+17‐15+20‐18 = 1+4+3+3+2+2 = 15
Wait Time P3 = 2
Wait Time P4 = 3+7‐4+11‐8+15‐12+18‐16+21‐19+23‐22+25‐24 = 3+3+3+3+2+2+1+1 = 18
Wait Time P5 = 4+8‐5+12‐9 = 4+3+3 = 10
Avg Wait Time = 62/5 = 12.4ms

Avg TAT =25+21+3+27+13 = 89/5 = 17.8ms

Algorithm  Avg Wait Avg TAT


FCFS  12.2  17.6
SJF  6.6  12
NonP Priority  9.6  15
RR  12.4  17.8
 

SJF has shortest wait and shortest TAT 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy