Homework 2 – Process Management and CPU Scheduling

 

COP 4610/CGS5765, Introduction to Operating Systems, Fall 2003, Florida State University

¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾

Points: 100 points

Due: Week 7, Tuesday, October 7, 2003

1.      (10 pnts) Problem 5 in the textbook on page 229.

a.       User name – process

b.      Stack bottom – thread

c.       Resources blocking me – thread

d.      Primary memory allocated to me – process

e.       Files allocated to me – process

f.        Execution state – thread

2.      (15 pnts) Problem 7 in the textbook on page 230.

3.      (15 pnts) Problem 4 in the textbook on page 281.

a.       Gantt chart

0  10   30   50       100          180

p2

 p1

 p3

  p4

     p0

 

b.      Turnaround time for p4 = 100

c.       Average wait time

      W(p_0) = 100
      W(p_1) = 10
      W(p_2) = 0
      W(p_3) = 30
      W(p_4) = 50
Average = (100+10+0+30+50)/5 = 38 

4.      (15 pnts) Problem 5 in the textbook on page 281.

a.       Gantt chart

0     20        70            150 160  180

  p1

   p4

     p0

p2

p3

b.      Turnaround time for p2 = 160

c.       Average wait time

      W(p_0) = 70
      W(p_1) = 0
      W(p_2) = 150
      W(p_3) = 160
      W(p_4) = 20
    Average = (70+0+150+160+20)/5 = 80 

5.      (15 pnts) Problem 7 in the textbook on page 281.

SJN scheduling with variable arrival times

0  10    35      75      105            150          215

P0

 p2

  p1

  p3

    P4

     p0

6.      (15 pnts) Problem 6 in the textbook on page 281.

Note that this is one solution. Other solutions are possible, depending on how you handle newly arrived processes.

RR scheduling with a time quantum of 15

a.       Gantt chart

0  15  30  45  60  75  85 100 115 130 140 145 160 175 190 205

p0

p1

p2

p0

p1

p2

p3

p4

p0

p1

p3

p4

p0

p4

p0

 

b.      Turnaround time for p3 = 65

c.       Average wait time

      W(p_0) = 0
      W(p_1) = 5
      W(p_2) = 20
      W(p_3) = 5
      W(p_4) = 15
 Average = (0+5+20+5+15)/5 = 9 

7.      (15 pnts) Problem 8 in the textbook on page 282 Here we assume the same system given in Problem 6 on Page 281.

Note that this is one solution. Other solutions are possible, depending on how you handle newly arrived processes.

RR scheduling with a time quantum of 15 & switch time of 5

a.       Gantt chart

0  15 20  35 40  55 60  75 80  95 100  110 115 130 135 150

p0

C

p1

C

p2

C

p0

C

p1

C

p2

C

 p3

C

 p4

150 155  170 175  185 190 195 200  215 220 235 240  255 260  275

C

 p0

C

 p1

C

p3

C

p4

C

 p0

C

 p4

C

 p0

 

b.      Turnaround time for p3 = 115

c.       Average wait time

      W(p_0) = 0
      W(p_1) = 10
      W(p_2) = 30
      W(p_3) = 35
      W(p_4) = 50
Average = (0+10+30+35+50)/5 = 25