1. Points 3, T.2.5, pg 71.
    Consider a computer that does not have a Test & Set Lock instruction, but does have an instruction to swap the contents of a register and a memory word in a single indivisible action. Can that be used to write a routine enter_region such as the one discussed in class.
     
  1. Points 3, T.2.20, pg 72,
    Measurements of a certain system have shown that the average process runs for a time T before blocking on i/o. A process switch requires a time S, which is effectively wasted (overhead). For round robin scheduling with quantum Q, give a formula for the CPU efficiency for each of the following:
    Note: CPU efficiency = useful CPU time / total CPU time
     
  1. Points 3, gen.3
    A soft real-time system has four periodic events with periods of 50, 100, 200, and 250 msec each. Suppose that the four events required 35, 20, 10, and X msec of CPU time, respectively. What is the largest value of X for which the system is schedulable.
     
  1. Points 3, T.2.23, pg 72,
    Five jobs are waiting to be run. Their expected run timers are 9, 6, 3, 5, and X. In what order should they be run to minimize average response time? (Your answer will depend on X).
     
  1. Points 5, s.5.4, pg. 151
    Suppose that the following processes arrive for execution at the times indicated. Each proces will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made

Process

Arrival Time

Brust Time

P1

0.0

8

P2

0.4

4

P3

1.0

1

    1. What is the average turnaround time for these processes with the FCFS scheduling algorithm?
    2. What is the average turnaround time for these process with the SJF scheduling algorithm?
    3. The SJF algorithm is supposed to improve perfromance, but notice that we chose to run process Pi at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Remember that processes p1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling.
       
      • ((P1's waiting time + P1's brust time) +
         (P2's waiting time + P2's brust time) +
         (P1's waiting time + P1's brust time)) / 3

        a. ((0 + 8) + (7.6 + 4) + (11+ 1) ) / 3 = 10.5333
        b. ((0 + 8) + (8.6 + 4) + (7+ 1) ) / 3 = 9.5333
        c. ((6 + 8) + (1.6 + 4) + (0+ 1) ) / 3 = 6.866
  1. Points 5 s.5.5, pg. 151
    Consider a variant of the RR scheduling algorithm where the entries in the ready queue are pointers to the PDBs.
    1. What would be the effect of putting two pointers to the same process in the ready queue?
    2. What would be the major advantages and disadvantages of this scheme?
    3. How would you modify the basic RR algorithm to achieve the same effect without the duplicate pointers?
       
      •  
        1. Priority process will get more precedence because two pointers can access priority process more ofte.
        2. Higher priority process will get more time to process.  Otherwise, lower priority process will get less time to process.
        3. Spend more time on higher priority process.
  1. Points 3, s.5.9, pg 152
    Suppose that a scheduling algorithm (at least of short-term CPU scheduling) favors those processes that have used the least processor time in the recent past. Why will this algorithm favor I/O bound programs and yet not permanently starve CPU-bound programs?
     
  1. Get on turing. Run ps and determine:
    1. the parent process owned by you for your session owned
    2. the parent process of the system for which your parent process is a child
    3. the longest chain of parent/children processes for your session.
    4. the scheduling priority of your processes.
    Turn in an anotated script file of your ps answering the questions above.
  2. psscript