首页 > 试题广场 >

Five batch jobs,

[问答题]

Five batch jobs, A through E, arrive at a computer center at essentially the same time. They have an estimated running time of 15, 9, 3, 6, and 12 minutes, respectively. Their priorities are 6, 3, 7, 9, and 4 respectively, with a lower value corresponding to a higher priority. For each of the following scheduling algorithms, determine the turnaround time for each process and the average turnaround for all jobs. Ignore process switching overhead. Explain how you arrived at your answers. In the last three cases, assume that only one job at a time runs until it finishes and that all jobs are completely processor bound. 20 pts

1 round robin with a time quantum of 1 minute; 5 pts

2 priority scheduling; 5 pts

3 FCFS (run in order A, B, C, D, and E); 5 pts

4 shortest job first. 5 pts

五、 Answer 20 pts

1 Sequence with which processes will get 1 min of processor time:


- 1 - / 3


1

2

3

4

5

Elapsed time

A

B

C

D

E

5

A

B

C

D

E

10

A

B

C

D

E

15

A

B

D

E

19

A

B

D

E

23

A

B

D

E

27

A

B

E

30

A

B

E

33

A

B

E

36

A

E

38

A

E

40

A

E

42

A

43

A

44

A

45

The turnaround time for each process:

A = 45 min, B = 35 min, C = 13 min, D = 26 min, E = 42 min

The average turnaround time is = (45+35+13+26+42) / 5 = 32.2 min

2

Priority

Job

Turnaround Time

3

B

9

4

E

9 + 12

= 21

6

A

21 + 15 = 36

7

C

36 + 3

= 39

9

D

39 + 6

= 45

The average turnaround time is: (9+21+36+39+45) / 5 = 30 min

3

Job

Turnaround Time

A

15

B

15 + 9 = 24

C

24 + 3 = 27

D

27 + 6 = 33

E

33 + 12 = 45

The average turnaround time is:  (15+24+27+33+45) / 5 = 28.8 min

4

Running Time

Job

Turnaround Time



3

C

3

6

D

3 + 6 = 9

9

B

9

+ 9 = 18

12

E

18

+ 12 = 30

15

A

30

+ 15 = 45

The average turnaround time is:

(3+9+18+30+45) / 5 = 21 min

发表于 2017-05-16 21:26:53 回复(0)