CS372H Spring 2010 Homework 6

Problem 1

Most round-robin schedulers use a fixed size quantum. Give an argument in favor of and against a small quantum.

Problem 2

As a system administrator you have noticed that usage peaks between 10:00AM to 5:00PM and between 7:00PM to 10:00PM. The company's CEO decided to call on you to design a system where during these peak hours there will be three levels of users. Users in level 1 are to enjoy better response time than users in level 2, who in turn will enjoy better response time than users in level 3. You are to design such a system so that all users will still get some progress, but with the indicated preferences in place.
  1. Will a fixed priority scheme with pre-emption and 3 fixed priorities work? Why, or why not?
  2. Will a UNIX-style multi-feedback queue work? Why, or why not?
  3. If none of the above works, could you design a scheduling scheme that meets the requirements?

Problem 3

A periodic task is one that is characterized with a period T, and a CPU time C, such that for every period T of real time, the task executes C time on the CPU. Periodic tasks occur in real-time applications such as multimedia. For example, a video display process needs to draw a picture every 40 msec (outside the US, Japan and Canada). To do so, such a process will have a period of 40 msec, and within each, it will require some time to do the data copying and drawing the picture after getting it from the video stream.

Admission control is a policy implemented by the process manager in which the manager decides whether it will be able to run a task with given parameters and with the existing load. Of course, if the process manager over commits itself, a periodic task will not be able to meet its processing requirement every period. For the video display process example, the picture flow will slow down and a viewer will notice and get irritated.
Assume that a system has 5 processes, an editor, a mail checking program, a video display process, a network browser and a clock display. The requirements are such that the mail checking program has to execute for 10 msec every 1sec, the video display must execute 25 msec every 40 msec, and the clock display must execute for 10 msec every 1 sec.

  1. What scheduling policy would you use for such a system?
  2. Two process schedulers are available for you. The first would consume about 5 msec of overhead in context switching every 40 msec, while the second consumes 0.5 msec of overhead in context switching every 40 msec. The first ensures that the periodic processes will get time on the CPU every 40 msec if they are ready, while the second uses simple round-robin scheduling. Which one is better suited for this application batch? Which one is more efficient?
  3. Assume that the clock display program actually underestimated the time it wanted to run, and instead has now to run for 20 msec every 40 msec. What should the system do? How could it do it? Explain your answers.
  4. If an audio unit is to be installed with an audio playback processing requiring 15 msec every 40 msec, would you be able to admit the process into the system? If yes explain why, and if not, explain why and suggest what the system could do.

Problem 4

Comparison of FIFO, RR and SRTF Algorithms. Given the following mix of job, job lengths, and arrival times, assume a time slice of 10 and compute the completion for each job and average response time for the FIFO, RR, and SRTF algorithms. Please use the following table format for your solution.

  Scheduling Algorithms
Job Length
(secs)
Arrival
time
FIFO RR SRTF
    Completion
time
Response
time
Completion
time
Response
time
Completion
time
Response
time
0850         
13010         
23510         
32080         
45085         
Average Response Time      

Problem 5

Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger priority numbers imply higher priority. When a process is waiting for CPU (in the ready queue, but not running), its priority changes at a rate of a (i.e., P(t) = P0 +a * (t - t0) where t0 is the time at which the process joins the ready queue) . Similarly, when it is running, its priority changes at a rate b. All processes are given a priority 0 when they enter the ready queue. The parameters a and b can be set to obtain many different scheduling algorithms.
  1. What is the algorithm that results from b > a > 0 ?
  2. What is the algorithm that results from a < b < 0 ?

Problem 6

Many scheduling algorithms are parameterized. For instance, the round-robin algorithm requires a parameter to indicate the time quantum. The multi-level feedback (MLF) scheduling algorithm requires parameters to define the number of queues, the scheduling algorithm for each queue, and the criteria to move processes between queues (and perhaps others. . .).

Hence, each of these algorithms represents a set of algorithms (e.g., the set of round-robin algorithms with different quantum sizes). Further, one set of algorithms may simulate another (e.g., round-robin with infinite quantum duration is the same as first-come, first-served (FCFS)). For each of the following pairs of algorithms, answer the following questions:

  1. Priority scheduling and shortest job first (SJF)
    1. State the parameters and behavior of priority scheduling
    2. State the parameters and behavior of SJF
    3. Can SJF simulate priority scheduling for all possible parameters of priority scheduling? (How or why not: State how to set SJF scheduling parameters as a function of priority scheduling parameters or explain why this cannot be done.)
    4. Can priority scheduling simulate SJF for all possible parameters of SJF? (How or why not.)

  2. Multilevel feedback queues and first come first served (FCFS)
    1. State the parameters and behavior of multi-level feedback queues
    2. State the parameters and behavior of FCFS
    3. Can FCFS simulate multi-level feedback for all possible parameters of multi-level feedback? (How or why not?)
    4. Can multi-level feedback scheduling simulate FCFS for all possible parameters of FCFS? (How or why not?)

  3. Priority scheduling and first come first served (FCFS)
    1. Can FCFS simulate priority scheduling for all possible parameters of priority scheduling? (How or why not?)
    2. Can priority scheduling simulate FCFS for all possible parameters of FCFS? (How or why not?)

  4. Round-robin and shortest job first (SJF)
    1. State the parameters and behavior of round robin
    2. Can round robin simulate SJF for all possible parameters of SJF? (How or why not?)
    3. Can SJF simulate round robin for all possible parameters of round robin? (How or why not?)