UNIVERSITY OF WISCONSIN-MADISON
Computer Sciences Department | ||
CS 537
Spring 2000 | A. Arpaci-Dusseau | |
Quiz #5: Wednesday, March 22 |
Name: | Student ID #: |
a) Consider a process that is at priority 49.
Timeline is not drawn to scale. Pri: 29 19 9 0 |-----------|------------|-------------|----------| 0 120ms 280ms 480 600c) 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.