Solution

Operating Systems

Problems to be Submitted (20 points)

  1. (10 points)
    1. (3 points)

      For FCFS, here is the Gantt chart:

      job from to
      p1 0 150
      p2 150 350
      p3 350 360
      p4 360 490
      p5 490 540
      p6 540 580

      Here is the computation of the turnaround times

      job arrival completion turnaround time
      p1 0 150 150
      p2 0 350 350
      p3 100 360 260
      p4 120 490 370
      p5 140 540 400
      p6 240 580 340
      avg 311.67

    2. (3 points)

      For SJN, here is the Gantt chart:

      job from to
      p1 0 150
      p3 150 160
      p5 160 210
      p4 210 340
      p6 340 380
      p2 380 580

      Here is the computation of the turnaround times

      job arrival completion turnaround time
      p1 0 150 150
      p2 0 580 580
      p3 100 160 60
      p4 120 340 220
      p5 140 210 70
      p6 240 380 140
      avg 203.33

    3. (4 points)

      For Round Robin with timeslice of 30, here is the Gantt chart:

      job from to (remaining)
      p1 0 30 120
      p2 30 60 170
      p1 60 90 90
      p2 90 120 140
      p3 120 130 completed
      p4 130 160 100
      p5 160 190 20
      p1 190 220 60
      p2 220 250 110
      p4 250 280 70
      p5 280 300 completed
      p6 300 330 10
      p1 330 360 30
      p2 360 390 80
      p4 390 420 40
      p6 420 430 completed
      p1 430 460 completed
      p2 460 490 50
      p4 490 520 10
      p2 520 550 20
      p4 550 560 completed
      p2 560 580 completed

      Here is the computation of the turnaround times

      job arrival completion turnaround time
      p1 0 460 460
      p2 0 580 580
      p3 100 130 30
      p4 120 560 440
      p5 140 300 160
      p6 240 430 190
      avg 310

  2. (3 points)
    1. 59089 = 58712 + 377

    2. 60134 = 58712 + 1422

    3. illegal address as logical 2535 is beyond the bounds register of 1587.

  3. (3 points)
    1. 145703

      logical address 6439 = 3*2048 + 295;
      thus <page,offset> = <3,295>;
      since Page 3 is mapped to Frame 71, physical address is 71*2048 + 295 = 145703.

    2. 113871

      logical address 9423 = 4*2048 + 1231;
      thus <page,offset> = <4,1231>;
      since Page 4 is mapped to Frame 55, physical address is 55*2048 + 1231 = 113871.

    3. illegal address

      logical address 11000 = 5*2048 + 760;
      thus <page,offset> = <5,760>;
      This is an illegal address, as no such Page 5 is defined.

  4. (4 points)
    1. Best-fit:

      an attempt to show our work...
      address original adding P1 adding P2 removing P1 adding P3 adding P4 adding P5 adding P6
      0 OS OS OS OS OS OS OS OS
      10
      20
      30
      40
      50
      60
      70
      80
      90
      100 empty P1 P1 empty empty P4 P4 P4
      110
      120
      130
      140
      150
      160 empty P5 P5
      170
      180
      190
      200
      210
      220
      230
      240 empty empty
      250
      260
      270
      280
      290
      300 empty P2 P2 P2 P2 P2 P2
      310
      320
      330
      340
      350
      360
      370
      380
      390
      400 empty empty P3 P3 P3 P3
      410
      420
      430
      440
      450
      460
      470 empty empty empty P6
      480
      490 empty

      Final Configuration
      Partitions
      process size
      OS 100 blocks
      P4 60 blocks
      P5 80 blocks
      Empty 60 blocks
      P2 100 blocks
      P3 70 blocks
      P6 20 blocks
      Empty 10 blocks

    2. Worst-fit:

      an attempt to show our work...
      address original adding P1 adding P2 removing P1 adding P3 adding P4 adding P5 adding P6
      0 OS OS OS OS OS OS OS OS
      10
      20
      30
      40
      50
      60
      70
      80
      90
      100 empty P1 P1 empty P3 P3 P3 P3
      110
      120
      130
      140
      150
      160
      170 empty P4 P4 P4
      180
      190
      200
      210
      220
      230 empty empty P6
      240
      250 empty
      260
      270
      280
      290
      300 empty P2 P2 P2 P2 P2 P2
      310
      320
      330
      340
      350
      360
      370
      380
      390
      400 empty empty empty empty P5 P5
      410
      420
      430
      440
      450
      460
      470
      480 empty empty
      490

      Final Configuration:
      Partitions
      process size
      OpSys 100 blocks
      P3 70 blocks
      P4 60 blocks
      P6 20 blocks
      Empty 50 blocks
      P2 100 blocks
      P5 80 blocks
      Empty 20 blocks


Extra Credit

  1. (2 points)

    For SRPT, here is the Gantt chart:

    job from to (remaining)
    p1 0 100 50
    p3 100 110 completed
    p1 110 160 completed
    p5 160 210 completed
    p4 210 240 100
    p6 240 280 completed
    p4 280 380 completed
    p2 380 580 completed

    Here is the computation of the turnaround times

    job arrival completion turnaround time
    p1 0 160 160
    p2 0 580 580
    p3 100 110 10
    p4 120 380 260
    p5 140 210 70
    p6 240 280 40
    avg 186.67

Last modified: Thursday, 29 November 2007