LECTURE 15: Thursday, Week 8

Scribe Noters:

   Tanya Gillis
   Stefan Vainberg
   Yahya Fahimuddin

Better page replacement policy

What is the optimal page replacement policy?

Ex. ref string: 0 1 2 3 0 1 4 0 1 2 3 4

A f0 0 0 0 0 0 0 0 0 f2 2 2
B f1 1 1 1 1 1 1 1 1 f3 3
C f2 f3 3 3 f4 4 4 4 4 4

Total: 7 faults

Least recently used:

Ex. using LRU on the previous example:

ref string: 0 1 2 3 0 1 4 0 1 2 3 4

A f0 0 0 f3 3 3 3 3 f4 4 f2 2
B f1 1 1 f0 0 0 0 0 0 f3 3
C f2 2 2 f1 1 1 1 1 1 f4

Total: 10 faults

How to implement LRU:

A)

  1. Mark all PTE's as pointing to inaccessible pages
  2. a page fault on every access
  3. kernel stores timestamps for that page. will this work?

B)

*p = syscall load(p)
load tells content of location
*p =v, syscall store(p,v)

-> have hardware update PTE on each access

Optimizations for paging:

Demand paging:

+ program starts faster

vs

load 1st N pages at once, where N is the number of pages in the program that fit.

+ better batching

vs

Dirty Bit Optimization:

code inside kernel to do paging:

void pfault(int va, )
{
    if (swapmap (va, current) == FaIL)
       kill (current, SIGSEGV)
    else {
       (p,va)=removal_policy()
       pa = p_pmap(va)
       write pa to disk at swapmap(va',p)
       read pa from disk_swapmap
       current -> p_pmap(v)=pa
   }
}

int swapmap(va,p)
{
   return disk address for va
   or
   FAIL
}

When can we skip dirty bit test?

Distributed Systems + RPC:

so far: modularity via virtualization

now: modularity via message passing:

implement message passing atop conventional virtual kernel

also do it by having multiple machines

+ flexibility
- performance

simple message-passing model

Remote Procedure Call:

Properties of RPC:

caller args, callee results

marshalling- taking a structure and converting it to sequence of bytes (efficient, not bloated, easy to generate, easy to parse)

callee args, caller results

unmarshalling- reverse

what you want (as a programmer) is an API

Ex.
r = arctan(x,y)
double arctan(double, double);
50 lines of code

Programs can take API and generate stubs

Examples of RPC:

RPC failure modes: Solutions:

exactly once RPC is not doable