Section Notes - 2/27/03

Section Outline:
 - Project questions answered
 - Review questions

Questions

1) For discussion:
 
It might help an operating system to know the working set for each process.  Which of the following choices is the best justification for this?

   i)  So the operating system can figure out the best page to replace.
   ii) So the operating system can know when memory is over-committed.

Answer:

ii) It is the job of the page replacement algorithm to determine which page is to be replaced - but even an optimal page replacement strategy can't prevent thrashing when there are too many processes in memory.  The operating system needs to know the working set of each process to determine when memory is overcommitted (i.e. thrashing is happening) so that a process can be swapped out to disk.



2) For discussion:

Consider the following events during a memory access:

i) Detecting a protection fault
ii) TLB miss
iii) Replacing a dirty page
iv) Replacing a clean page

Order these events by cost (time taken).

Answer:

1 ~= 2, 4, 3



Suppose a disk has 5000 cylinders (numbered 0 - 4999).
Suppose also that the drive is currently servicing 143, and previously serviced 125.
Given that the pending requests in FIFO order are:
     86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130

Rank the following algorithms from most to least fair:
a) FCFS
b) SSTF
c) SCAN
d) LOOK
e) C-SCAN

Using the above algortihms, what is the seek order?
What is the total distance moved by the disk head (in cylinders)?

Answer:

Ranking (most to least fair):
   FCFS
   C-SCAN
   SCAN
   LOOK
   SSTF

FCFS:

86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130
# cylinders: 7081

C-Scan:

913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 0, 86
# cylinders: 9985

SCAN:

913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86
# cylinders: 9769

LOOK:


913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86
# cylinders: 3319

SSTF:

130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774
# cylinders: 1745