Lecture 018

Copy on Write

Effective memory access time:

(1 - p_{\text{miss}}) * T_{\text{memory}} + p_{\text{miss}} * T_{\text{disk}}

Where:

Copy-on-write:

mmap():

Page Eviction

Page eviction daemon: scan for frames once a while (swappiness)

How to choose a page to evict:

How many frame should an address space have?

Thrashing: a program can only run given 20 frames, but the system keep wanting it to have only 19 frames. So the program keep generating page faults, denial of service attack on paging system.

Balancing Fault Rate: keep system-wide "average fault rate", if a process fault too much, increase its quota, if a process fault too little, decrease its quota. (fair fault rate)

This problem isn't just OS problem, linker can help keeping relevant code together.

// LRU approximation with "clock" algorithm
boolean reference[nframes]; // reference bit for each frame
int choose_victim() {
  static int nextpage = 0;
  while (reference[nextpage] == 1) {
    reference[nextpage] = 0;
    nextpage = (nextpage + 1) % nframes;
  }
  return nextpage;
}

Service Request

Service Request

Table of Content