0% found this document useful (0 votes)
2 views

assignment no 2- OS

Uploaded by

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

assignment no 2- OS

Uploaded by

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

ASSIGNMENT NO 2

SUBMITTED TO:
MA’AM SADIA WAHEED
SUBMITTED BY:
M HAMZA SAJJAD
REGISTRATION NO:
UW-22-AI-BS-042
COURSE TITLE:
OPERATING SYSTEM

DEPARTMENT OF COMPUTER SCIENCE ( AI )


UNIVERSITY OF WAH
First Come First Serve:
Make a gantt chart
Gantt Chart:
P1 P2 P3 P4
0 8 12 21
26

Completion Time:
P1=8
P2=12
P3=21
P4=26
Turnaround Time:
Formula for turnaround time = Turnaround Time= Completion Time – Arrival Time
P1=8-0=0
P2=12-0=12
P3=21-0=21
P4=26-0=26

Average Turnaround Time:


Average TAT=8+12+21+26/4
=16.75

Waiting Time:
Formula for waiting time is: Turnaround time – Burst time
P1=8-8=0
P2=12-4=8
P3=21-9=13
P4=26-5=21

Average Time:
AWT=0+8+13+21/4
=10.25
Shortest job first:
Gantt Chart:
P2 P4 P1 P3
0 4 9 17
26

Completion Time:
P2=4
P4=9
P1=17
P3=26
Turnaround Time
P2=4-0=4
P4=9-0=9
P1=17-0=17
P3=26-0=26
Average Turnaround Time:
ATT= 4+9+17+26/4
=14
Waiting Time:
P2=4-4=0
P4=9-5=4
P1=17-8=9
P3=26-9=17
Average Waiting Time:
AWT=0+4+9+17/4
=7.5

Priority Scheduling:
Gant Chart for non Premptive
P2 P4 P1 P3
0 4 9 17 26
Turnaround Time:
P2=4-0=4
P4=9-0=9
P1=17-0=17
P3=26-0=26
Average Turnaround time:
=4+9+17+26/4
=14
Waiting Time
P2=4-4=0
P4=9-5=4
P1=17-8=9
P3=26-9=17
Average Waiting Time:
=0+4+9+17/4
=7.5
Pre-Emptive:
Gantt Chart
P2 P2 P2 P2 P4 P4 P4 P4 P1 P1 P1 P1 P1 P1 P1 P1 P1 P3
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18

P3 P3 P3 P3 P3 P3 P3 P3
19 20 21 22 23 24 25 26
Completion Time:
P2=4
P1=17
P4=9
P3=26
Turnaround Time:
P2=4-0=4
P4=9-0=9
P1=17-0=17
P3=26-0=26
Average Turnaround Time:
=4+9+17+26/4
=14
Waiting time:
P2=4-4=0
P4=9-5=4
P1=17-8=9
P2=26-9=17
Average Waiting Time:
=0+4+9+17/4
=7.5

You might also like