Uploaded by Maram Alamer

OS

advertisement
MaramMohammed
Assignment 1
442803425
Exercise 1: Consider the following set of processes:
Arrival time
0
0
0
0
0
P1
P2
P3
P4
P5
Burst time
6
5
2
8
3
a- Draw 2 Gantt charts to illustrate how these processes would be scheduled
using SJF, FCFS.
b- Calculate the obtained average waiting time for each algorithm.
Exercise 2: Consider below table of four processes under Multi-level queue scheduling.
Queue number denotes the queue of the process.
Note that priority of queue 1 is greater than queue 2.
P1
P2
P3
P4
P5
P6
Arrival time
0
2
0
23
0
0
Burst time
7
5
8
4
4
4
Queue
1
2
1
1
2
1
a- Draw a Gantt chart to illustrate how these processes would be scheduled if Queue 1
uses Round Robin (Time Quantum=7) and Queue 2 uses FCFS.
Note that a task with the highest priority can interrupt the execution of task with a
lower priority.
b- Calculate the waiting time for each process
c- Calculate the average waiting time
f cfs
1
Ps Ps Pe P
sq
o
e s
Pe
to 16 a
P
12 5
Ps
o
13 2
16 2
6.6
5
Pa Ps
is
n
at
a
Waitingtime
14 16
Average time to 5 0
6
o
time
P P
Pi
o
12 6 13 11 14 13
Averagetime
15 21
0t6t tt
10,2
2
Q1
P BPaPA
Oz
PaPs
o
e
14
o
3,191 B
P
Pe B
o
12 16 13 24 Pa
o
pg
Arerase time otistattotzetz
Prep p p
3,5
6
is as a si
Arrival
time
Burst
time
Pi
a
f
Pa
2
5
P
O
Pa
23
8
Ps
Pr
Tat
wt
7
7
0
23
21
1
32
16
32
27
4
1
27
4
o
0
4
2
31
31
27
0
4
I
18
18
14
Queue
1
complettime
z
pray
Download