15. Page Translation Flashcards

1
Q

Ideally, what do we want from address translation?

A

Fast mapping from ANY virtual byte to ANY physical byte.

OS cannot do this (too slow). We need the help of hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Segments are too large, leading to internal fragmentation, and mapping individual bytes limits the amount of data the TLB can cache. What is the modern solution (middle ground) to these constraints? How does execution locality come into play?

A

Pages.

Choose a translation granularity that is small enough to limit internal fragmentation, but large enough to allow the TLB to cache entires covering a significant amount of physical memory.

This also limits the size of kernel data structures associated with memory management.

Execution locality helps here because process memory accesses are typically highly spatially clustered, so even a small cache can be very effective

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is execution locality?

A

Process memory accesses are typically highly spatially clustered.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are some typical page sizes?

A

4K is very common. 8K or larger pare also sometimes used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is true about the size of the bound for pages?

A

You can think of pages as fixed sized segments, so the bound is the same for each

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a virtual page number (VPN)?

A

The portion of the virtual address that identifies the page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the offset portion of a virtual address?

A

The remaining bits of the virtual address after the part that identifies the page. The offset refers to the entry number on the page itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the relationship between virtual pages and physical pages?

A

Virtual pages map to physical pages and all addresses inside a single virtual page map to the same physical page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two steps to carry out a page translation?

A
  1. Check if a virtual page to physical page translation exists for the given virtual page.

(For 4K pages, split 32-bit address into virtual page number (top 20 bits) and offset (bottom 12 bits) and then check)

  1. Do the translation. Physical address = Physical page + offset
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where do entries in the TLB come from?

A

The operating system loads them in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens if a process tries to access an address that is not in the TLB?

A

The TLB asks the operating system for help via a TLB exception. The operating system must either load the mapping or figure out what to do with the process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the PROS of paging?

A
  1. We can organize and protect regions of memory appropriately (How?)
  2. It is a better fit for address spaces. Even less internal fragmentation than segmentation due to smaller allocation size (4K)
  3. There is NO external fragmentation because pages have a fixed allocation size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the CONS of paging?

A
  1. It requires per-page hardware translation.

2. It requires per-page operating system state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How much memory can we cache translations for using 4K pages and a 128-entry TLB?

A

512 KB of memory, because 128 entries * 4K per entry = 512K

How well did you know this?
1
Not at all
2
3
4
5
Perfectly