Homework 4

  1. Scheduling Strategies
    Consider the following set of processes, with the length of the CPU-burst time giving in milliseconds:
    Process   Burst Time   Priority
    -------------------------------
    p_0         10            3
    p_1          1            1
    p_2          2            3
    p_3          1            4
    p_4          5            2
    
    The processes are assumed to have arrived in the order p_0, p_1, p_2, p_3, p_4, all at time 0.
    1. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJN, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling.
    2. What is the turnaround time of each process for each of the scheduling algorithms in part a?
    3. What is the waiting time of each process for each of the scheduling algorithms in part a?
    4. Which of the schedules in part a results in the minimal average waiting time (over all processes)?


  2. Scheduling Strategies
    Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger priority numbers imply higher priority. When a process is waiting for the CPU (in the ready queue, but not running), its priority changes at rate alpha; when it is running, its priority changes at a rate beta. All processes are given a priority of 0 when they enter the ready queue. The parameters alpha and beta can be set to give many different algorithms.
    1. What is the algorithm that results from beta > alpha > 0?
    2. What is the algorithm that results from alpha < beta < 0?


  3. Scheduling Strategies
    Many CPU scheduling algorithms are parameterized. For example, the RR algorithm requires a parameter to indicate the time slice. Multilevel feedback queues require parameters to define the number of queues, the scheduling algorithms for each queue, the criteria used to move processes between queues, and so on.
    These algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another (for example, the FCFS algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between the following pairs of sets of algorithms?
    1. Priority and SJN
    2. Multilevel feedback queues and FCFS
    3. Priority and FCFS
    4. RR and SJN


  4. Predicting the next CPU Burst
    Consider the exponential average method of predicting future CPU bursts based on past history (pp. 131-132 of your text). For each of the process burst patterns shown in the attached figures:




  5. Design of a Round Robin Scheduler

    Warning: The bulk of this problem is understanding what is called for. You should spend a lot of time dissecting the problem. The solution itself is not long. You might see this problem on the midterm.
    You are to write high level pseudo-code for a short term scheduler / process scheduler which implements a round robin scheduling algorithm with time quantum TAU. This means that each process is scheduled to run for at most TAU units of time.