UNIVERSITY OF WISCONSIN-MADISON
Computer Sciences Department
CS 537
Spring 2000
A. Arpaci-Dusseau
Quiz #5: Wednesday, March 22

Name: Student ID #:

Solaris Time-Sharing Scheduler

Problem 1: Solaris Dispatch Table (80 pts)

To answer this problem, use the dispatch table that is appended at the end of the quiz (it is identical to the default dispatch table in Solaris).

a) Consider a process that is at priority 49.

  1. How long is the time-slice of this process?
    40ms
  2. When the process consumes its time-slice, what will its new priority be?
    39
  3. If the process is neither sleeping nor running when the 1 second update time expires, what will its new priority be?
    59
  4. If the process is sleeping when the 1 second update timer expires, what will its new priority be?
    58
b) Consider a workload containing only a single process. Assume that this process is completely CPU-bound. Draw a timeline showing the priority of that process for the first 600ms of its lifetime. In all of your timelines, clearly show both the priority of the job and the time at which the priority of the process changes. Assume that the 1 second update timer does not run in this interval. (Hint: Processes start at priority 29.)


Timeline is not drawn to scale. 

Pri:     29           19            9             0
    |-----------|------------|-------------|----------|
    0           120ms       280ms          480        600

c) Consider a new workload containing a single process; this process repeatedly computes for 20ms and then sleeps for 1000ms. Draw a timeline showing the priority of this process for 3 iterations of its compute/sleep cycle. You can assume that the 1 second update timer begins its cycle at the same time the process enters the system (i.e., the timer expires 1 second after the process begins executing).

Timeline is not drawn to scale. 

Pri: 29      sleep               52    sleep           58   sleep
    |----|---------------------|----|----------------|----|-------------|
    0    20ms                  1020 1040             2040 2060          3060

When the update timer runs at 1000ms and 2000ms, it increments the dispwait 
variable of the job to 1.  When the job wakes, it sees that 
dispwait > maxwait (0), so the priority of the job is raised to that 
specified by slpret and dispwait is set back to 0.

d) Consider a dispatch table where the fourth column contains all 1's (instead of all 0's). Show the priority timeline for the workload of question c) with this modified dispatch table.

Timeline is not drawn to scale. 

Pri: 29      sleep               29    sleep           52   sleep
    |----|---------------------|----|----------------|----|-------------|
    0    20ms                  1020 1040             2040 2060          3060


When the update timer runs at 1000ms, it increments the dispwait 
variable of the job to 1.  When the job wakes, it sees that 
dispwait is not greater than maxwait (1), so the priority of the job 
stays the same.

When the update timer runs at 2000ms, it increments the dispwait 
variable of the job to 2.  When the job wakes, it sees that 
dispwait > maxwait (1), so the priority of the job is raised to 52 as
specified by the dispatch table.  The variable dispwait is cleared at
this time.

In class, students pointed out that in the notes, when describing the maxwait
field, I said "ts_dispwait is initialized to zero each time a process is
placed back on the dispatch queue after its time quantum has expired or
when it is awakened."  This statement is not specific enough.  It should be
changed to "ts_dispwait is initialized to zero each time the time quantum
of the process expires or after the priority of the process is changed
because ts_dispwait exceeded ts_maxwait."  (I verified in the Solaris
source code that this is in fact how the TS scheduler behaves.)

If this (incorrect) algorithm is followed, you will get the results:

Pri: 29      sleep               29    sleep           29   sleep
    |----|---------------------|----|----------------|----|-------------|
    0    20ms                  1020 1040             2040 2060          3060


This is acceptable for this quiz question, but is not how you should
implement the code in your Project #3.

Problem 2: Required Accounting (20 points)

List three pieces of accounting information that must be tracked and recorded for each process when implementing the functionality of the Solaris Time-sharing Scheduler. (Do not include any items that are simply pointers to other data structures).

  1. priority
  2. timeleft (time remaining in timeslice)
  3. dispwait