
CS485G Spring 2015 58
(c) The general idea is to employ the ”recently accessed” bit in the
page table to find a victim that has not been recently accessed,
hoping that it won’t be accessed soon.
(d) If the victim is dirty, it must be written to disk. If it is clean,
there is already a good copy on disk.
9. Programs exhibit locality of reference, which is why swapping in a
page works for a long time, and why processes tend not to need all
their virtual pages in memory most of the time. The kernel tries to
make sure that at least the working set of virtual pages are kept in
physical memory.
10. Multi-level page tables
(a) A table of length 2
20
is unwieldy. The situation is even worse on
an x86 64.
(b) Therefore, the table is built in multiple levels: 2 levels on the
x86, 3 levels on the x86 64.
(c) The virtual address is composed of three pieces: 10 bits (top
level), 10 bits (second level), 12 bits (offset). The top-level bits
index an entry in a top-level table of length 2
10
= 1024 entries,
which is in a single physical page pointed to by a hardware reg-
ister.
(d) The top-level entry addresses the second-level page table, also
of length 2
10
= 1024 entries, fitting in a single page.
(e) There can be a page fault to access that second-level page table.
56 Free-space allocation
1. malloc() and friends maintain data structures that implement the
heap.
2. When they run out of memory, they can use the sbrk() system call
to request more data space.
3. Allocation is usually aligned to 8-byte boundaries.
4. There are several data structures that malloc() could use.
(a) Boundary tag method
i. Every allocated region has a few bytes before and after, called
tags, that indicate the length of the region.
Comentarios a estos manuales