CS372H Spring 2011 Homework 6
Problem 1
Most roundrobin 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.

Will a fixed priority scheme with preemption and
3 fixed priorities work? Why, or why not?

Will a UNIXstyle multifeedback queue work? Why,
or why not?

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 realtime 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.

What scheduling policy would you use for such a
system?

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
roundrobin scheduling. Which one is better suited for this application
batch? Which one is more efficient?

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.
 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 
0  85  0 
 
 
 
1  30  10 
 
 
 
2  35  10 
 
 
 
3  20  80 
 
 
 
4  50  85 
 
 
 
Average Response Time 



Problem 5
Consider the following preemptive priorityscheduling
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)
= P_{0 }+a * (t  t_{0}) where t_{0} 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.

What is the algorithm that results from b > a > 0 ?

What is the algorithm that results from a < b < 0 ?
Problem 6
Many scheduling algorithms are parameterized. For instance, the
roundrobin algorithm requires a parameter to indicate the time quantum.
The multilevel 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 roundrobin algorithms with
different quantum sizes).
Further, one set of algorithms may simulate
another (e.g., roundrobin with infinite quantum duration is the
same as firstcome, firstserved (FCFS)). For each of the following pairs of
algorithms, answer the following questions:
 Priority scheduling and shortest job first (SJF)
 State the parameters and behavior of priority scheduling
 State the parameters and behavior of SJF
 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.)
 Can priority scheduling simulate SJF for all possible parameters of SJF?
(How or why not.)

Multilevel feedback queues and first come first served (FCFS)
 State the parameters and behavior of multilevel feedback queues
 State the parameters and behavior of FCFS
 Can FCFS simulate multilevel feedback for all possible parameters of
multilevel feedback? (How or why not?)
 Can multilevel feedback scheduling simulate FCFS for all possible
parameters of FCFS?
(How or why not?)

Priority scheduling and first come first served (FCFS)
 Can FCFS simulate priority scheduling for all possible parameters
of priority scheduling? (How or why not?)
 Can priority scheduling simulate FCFS for all possible
parameters of FCFS? (How or why not?)
 Roundrobin and shortest job first (SJF)
 State the parameters and behavior of round robin
 Can round robin simulate SJF for all possible parameters
of SJF? (How or why not?)
 Can SJF simulate round robin for all possible parameters
of round robin? (How or why not?)