Cpu Scheduling Assignment-Cs 303
Cpu Scheduling Assignment-Cs 303
3)
Objectives of CPU scheduling algorithms:
1.Maximum throughput
2.Efficient and effective system
3.Less turn around time
4.Less waiting time
5. Less response time
4)
1. CPU utilization and response time: CPU utilization is increased if the
overheads associated with
context switching is reduced.
0 12 17 23 27
2.
AWT: 0+12+17+23/4= 52/4=13
5.3.
No it is not optimal because, under FCFS method, the early arrived processes
are served first although they take a long time to proceed. the later arrived
processes are there with a very small amount of burst time. But those
processes are ineffectively and unnecessarily waiting for the prior processes to
complete which is increasing the waiting time, turn around time and
completion time; Eventually leading to high average wait time whoch is not a
good outcome.
6)
7)
1.Shortest job first
2. Shortest Remaining time first (preemptive)
3.preemptive and non preemptive prioroty queue
8)
1.FCFC
P1 P2 P3 P4 P5
0 2 3 11 15 20
Process TAT WT
(CT-AT) (TA-BT)
P1 2 2-2=0
P2 3 3-1=0
P3 11 11-8=3
P4 15 15-4=11
P5 20 20-5=15
Total=51 Total=31
ATT=51/5=10.2 AWT=31/5=6.2
2.SJF
P2 P1 P4 P5 P3
0 1 3 7 12 20
Turn around time(TAT) and wait time under SJF(with averages)
Process TAT WT
(CT-AT) (TA-BT)
P2 1 0
P1 3 1
P4 7 3
P5 12 7
P3 20 12
Total=43 Total=23
ATT=43/5=8.3 AWT=23/5=4.6
P3 P5 P1 P4 P2
0 8 12 15 19 20
Process TAT WT
(CT-AT) (TA-BT)
P3 8 0
P5 13 8
P1 15 13
P4 19 15
P2 20 19
Total=75 Total=55
ATT=75/5=15 AWT=55/5=11
4.Round Robin
P1 P2 P3 P4 P5 P3 P4 P5 P3 P5 P3
0 2 3 5 7 9 11 13 15 17 18 20
Process TAT WT
(CT-AT) (TA-BT)
P1 2 0
P2 3 2
P3 20 12
P4 13 9
P5 18 13
Total=56 Total=36
ATT=56/5=11.2 AWT=36/5=7.2
8.4) shortest job first incurs the minimum average wait time
9) SRTN
A B A C E D
0 3 5 8 12 15 21
Process TAT WT
A 8 2
B 2 0
C 7 3
D 14 8
E 5 2
Total: 36 Total: 15
10)
P1 P1 Iddle P2 P3 P2 P3 P4 P4 P2 P3 Iddle P5 P6 P5
Process TAT WT
P1 20 0
P2 55 30
P3 60 35
P4 15 0
P5 20 10
P6 10 0
Total: 180 Total: 75
H.M.M.S.N.Deshapriya
S/16/909