Quiz 2 solutions

  1. In the diagram of process states, a CPU-bound process transitions repeatedly between which states?

    CPU-bound means you are primarily switching repeatedly between ready and running. The waiting state involves waiting on an I/O operation. In the ready state, you’re waiting only for the CPU.

  2. Schedule the following processes using first-come, first-served (FCFS). Use batch scheduling (no timer). Pay close attention to arrival times; a process cannot start before its arrival time.

    Process  Arrival Time  CPU Time
     P1        0             3
     P2        0             5
     P3        2             2
     P4        8             6
    
      P1    P2    P3    P4
    +-----+-----+-----+-----+
    0     3     8     10    16
  3. Compute the average turn-around time of the four processes on your FCFS schedule in the previous question.

    P1:  3 - 0 = 3
    P2:  8 - 0 = 8
    P3: 10 - 2 = 8
    P4: 16 - 8 = 8  Sum = 27. Avg = 27 ÷ 4 = 6.75
  4. Now schedule the same four processes using shortest job first (SJF) and compute turn-around time. You must still pay attention to the arrival time!

      P1    P3    P2    P4
    +-----+-----+-----+-----+
    0     3     5     10    16
    
    P1:  3 - 0 =  3
    P2: 10 - 0 = 10
    P3:  5 - 2 =  3
    P4: 16 - 8 =  8  Sum = 24. Avg = 24 ÷ 4 = 6
comments powered by Disqus

 

©2012 Christopher League · some rights reserved · CC by-sa