Sunteți pe pagina 1din 9

SCHEDULING PROBLEMS

The following series of processes with the given estimated run-times arrive in the
Ready queue in the order shown. For FCFS and SJF scheduling policies, draw the
Gantt chart and Calculate the average waiting time and the average turn around
time.
Job

Est:Run Time

1
2
3
4
5

10
50
02
100
05

Solution
Job
1
2
3
4
5

E.R.T
10
50
02
100
05

Waiting Time
0
10
60
62
162

Turn-Around time
10
60
62
162
167

294

461

Gantt chart for FCFS


Job1
0

Job2
10

Job3
60

Job4
62

Job5
162

167

Wt for Job1+ Wt for Job2+ Wt for Job3


Average waiting time =
Number of Jobs

0 + 10 + 60 + 62 + 162
AWT=
5
294
AWT=

AWT for FCFS = 58.8 Timeunits


5

Average TurnArround Time For FCFS

TAT for Job1 + TAT for Job2 + +TAT for Job5


ATAT=
Number of Jobs
10 + 60 + 62 + 162 + 167
ATAT =
5
461
ATAT =
5
ATAT for FCFS = 92.2 Timeunits

Solution for SJF


Job
3
5
1
2
4

E.R.T
02
05
10
50
100

W.T
0
02
07
17
67

T.A.T
02
07
17
67
167

93

260

Gantt Chart for SJF

Job3
0

Job5
2

Job1
7

Job2
17

Average Waiting Time for SJF


93
AWT =
5
AWT for SJF = 18.6 Timeunits

Average TurnArround Time for SJF


260
ATAT =
5
ATAT for SJF = 52 Timeunits

Job4
67

167

ROUND ROBIN
Following bunch of jobs arrive in Ready Queue as shown with a Quantum of 4
Timeunits.Draw the Gantt chart and calculate the average waiting time and average
turnarround time using round robin policy.

Job
1
2
3

E.R.T
24
03
03

SOLUTION
Gantt Chart
Job1 Job2 Job3 Job1 Job1 Job1
Job1
0
4
7
10 14
18
22
Job
1
2
3

E.R.T
24
03
03

W.T
06
04
07

17
AWT =
3
AWT = 5.66 Timeunits
47
ATAT =
3
ATAT = 15.66 Timeunits

T.A.T
30
07
10

Job1
26
30

SHORTEST JOB FIRST


Consider the following set of jobs,using SJF policy draw the Gantt chart and
calculate the average waiting time and average turnaround time.
Job
1
2
3
4

E.R.T
6
3
8
7

SOLUTION
Gantt Chart
Job2

Job1

Job
2
1
4
3

ERT
3
6
7
8

Job4
9

16

WT
0
3
12
16

TAT
3
9
16
24

0 + 3 + 12 + 16
AWT =
4
AWT= 31/4

= 7.7 Timeunits

3 + 9 + 16 + 24
ATAT =
4
52
ATAT =
4
ATAT = 13 Timeunits

Job3
24

SHORTEST REMAINING TIME


A bunch of jobs arrive in Ready Queue their respective arrival times and estimated
run-times are also shown. Draw the Gantt chart and calculate the average waiting
time and average turnarround time using Shortest Remaining Time policy.

Job
1
2
3
4

Arrival time
0
1
2
3

E.R.T
8
4
9
5

SOLUTION

Gantt Chart for SRT


PREEMPTION
Job1

Job2

Job
1
2
3
4

AT
0
1
2
3

Job4
5

ERT
8
4
9
5

Job1
10

WT
09
01
17
05

TAT
17
05
26
10

Job1 (WT-AT) +. + Jobn (WT-AT)


AWT =
Number of Jobs

Job3
17

26

Job1 (TAT-AT) +. + Jobn (TAT-AT)


ATAT =
Number of Jobs

(09-00) + (01-01) + (17-02) + (05-03)


AWT =
4

09 + 0 + 15 + 02

26

=
4

AWT= 6.5 Timeunits

(17-00) + (05-01) + (26-02) + (10-03)


ATAT =
4

17 + 04 + 24 + 07
ATAT =

52
=

ATAT = 13 Timeunits

Q: Assume cluster size of 512 bytes for each of the file size listed below calculate the wastage in file
space due to incomplete filling of last cluster.
File size A=2700 bytes.
File size B=3100 bytes.
File size C=17000 bytes.
Sol:

Number of Cluster of file A = 2700/512 = 5.273 = 6 (rounded up to whole number)


Total cluster capacity
= 6*512 = 3072 bytes
Wasted space
= Total cluster capacity File size
= 3072 2700
= 372 bytes wasted space
372
Percentage of wasted space = -------- * 100 = 12.10 %
3072
Number of Cluster of file B = 3100/512 = 6.054=7 (rounded up to whole number)
Total cluster capacity
= 7*512 = 3584 Bytes
Wasted space
= Total cluster capacity File size
= 3584 3100
= 484 bytes wasted space
484
Percentage of wasted space = -------- * 100 = 13.50 %
3584
Number of Cluster of file C = 17000/512 = 33.203 = 34 (rounded up to whole number)
Total cluster capacity
= 34*512 = 17408 bytes
Wasted space
= Total cluster capacity File size
= 17408 17000
= 408 bytes wasted space
408
Percentage of wasted space = -------- * 100 = 2.34 %
17408
Q: Using the following parameters for a disk system, calculate the number of cluster entries in a FAT.
Disk capacity = 25MB
Block Size = 512 bytes
Blocks/Cluster = 2
Sol:
Size of cluster = 2*512 = 1024 bytes

Number of cluster = 25*1024*1024 1024


= 25*1024 = 25600
Q: Assume cluster size of 512 bytes for each of the file size listed below calculate the wastage in file space
due to incomplete filling of last cluster.
File size A=1300 bytes.
File size B=20,000 bytes.
File size C=127,000 bytes.
Sol:

Number of Cluster of file A = 1300/512 = 2.54 = 3 (rounded up to whole number)


Total cluster capacity
= 3*512 = 1536 bytes
Wasted space
= Total cluster capacity File size
= 1536 1300 = 236 bytes wasted space

236
Percentage of wasted space = -------- * 100 = 15.36 %
1536
Number of Cluster of file B = 20,000/512 = 39.06= 40 (rounded up to whole number)
Total cluster capacity
= 40*512 = 20480 Bytes
Wasted space
= Total cluster capacity File size
= 20480 20,000
= 480 bytes wasted space
480
Percentage of wasted space = -------- * 100 = 2.34%
20480
Number of Cluster of file C = 127000/512 = 248.04 = 249 (rounded up to whole number)
Total cluster capacity
= 249*512 = 127488 bytes
Wasted space
= Total cluster capacity File size
= 127488 127000
= 488 bytes wasted space
488
Percentage of wasted space = -------- * 100 = .382 %
127488
Q: Using the following parameters for a disk system, calculate the number of cluster entries in a FAT.
Disk capacity = 14MB
Block Size = 512 bytes
Blocks/Cluster = 3
Sol:
Size of cluster = 3*512 = 1536 bytes
Number of cluster = 14*1024*1024/1536
= 9557.33

S-ar putea să vă placă și