CS 111
Lecture 16 Scribe Notes: VM and processes; distributed systems
Scribes: Derek Zhou
A bit of code to run when page faulting
// gets real address in RAM for a given virtual address
pmap(va)
    each process gets its own page table - necessary for isolation, threads in a process have just
         one page table
    each process haves own pmap function p->pmap


// gives disk address for a given virtual address
p->swapmap(va)
{
// something like this
if(va > p->valim) ? FAULT : return p-> diskorigin + va;
}


// takes process that faulted, virtual address that faulted
pfault(p, va)
{
if(p->swapmap(va) == FAULT) kill(p);
else {
// op is other process, ova is other virtual address
(op, ova) == removal_policy();
pa = op->pmap(ova);
// write pa block to disk @ op->swapmap(ova)
// read pa block from disk @ p->swapmap(va)
// not real c-code (updates page tables)
p->pmap(va) = pa;
op->pmap(va) = FAULT;
}
}