14. Address Translation Flashcards

1
Q

What does the hardware memory management unit (MMU) do during virtual address translation?

A

It speeds the process of translation once the kernel has told it how to translate an address or according to architectural conventions (MMU is the mechanism)

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

What does the OS memory management subsystem do during virtual address translation?

A

It manages translation policies by telling the MMU what to do

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

When considering virtual address translation mechanism vs its policy, what is the larger goal?

A

To have the system follow established OS policies while involving the OS directly in the translation as little as possible (because it’s time consuming to trap into the kernel)

Almost every virtual address translation should be able to proceed without kernel assistance.

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

Why should almost every virtual address translation be able to proceed without kernel assistance?

A

The kernel is too slow! Recall that the kernel sets the policy. It’s up to the hardware to provide the mechanism.

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

What is explicit address translation?

A

The process asks the kernel explicitly what physical address a given virtual address maps to.

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

Does explicit address translation work?

A

No. It’s unsafe to allow processes to access/use physical addresses directly (via using the kernel to map to it). All addresses must be translated so processes never know where in physical memory they are

(Think back to the nice controls that address translation provides the kernels. Those controls go away if the process learns where stuff is in physical memory)

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

What is implicit translation?

A

When a process acts on a virtual address, but unbeknownst to the process, the machine caries out that action on a physical address that is hidden from the process.

Implicit because the process never knows (and doesn’t need to know) that a translation occurred

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

What is the “Base and Bound” virtual address mapping approach?

A

First, assign each process a base physical address and a bound (how far it can go from that base)

Then check to see that the virtual address is between that base and bound.

Finally, translate. The physical address = the virtual address provided + the base address assigned to that process

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

What are the PROS of the “Base and Bounds” approach to virtual address mapping?

A

It’s super simple. Hardware only needs to know the base and bounds for each process.

It’s fast. To enforce protection, hardware does one comparison. To carry out translation, hardware does one addition.

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

What are the CONS of the “Base and Bounds” approach to virtual address mapping?

A
  1. It is not a good fit for our address space abstraction because address spaces encourage discontiguous allocation. Base and bounds allocation must be contiguous, otherwise we will lose memory to internal fragmentation (unused mem in address space)
  2. There is significant chance of external fragmentation due to large contiguous allocations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the “Segmentation” approach to virtual address mapping?

A

It builds off of the base and bounds approach.

We can give multiple bases and bounds per process to allow for discontiguous allocations. We call each base-bound pair a segment.

We can assign each logical region of the address space (code, data, heap, stack) to its own segment, with their own separate size and permissions.

First, each segment has a start virtual address, base physical address, and bound.

Then, check that the provided virtual address is located within a valid segment (Segment start < VA < Segment start + segment bound)

Finally, translate the virtual address as follows:
Physical address = (VA - Seg start) + Seg base

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

What are the PROS of the segmentation approach to virtual address translation?

A
  1. It’s still fairly simple. Protection is enforced (meaning segment exists) with n comparisons for n segments. Translation is done with one addition after the segment is located.
  2. We can organize and protect different regions of memory appropriately (stack, heap, code, data should have different permissions)
  3. It’s a better fit for address spaces, leading to less internal fragmentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the CONS of the segmentation approach to virtual address translation?

A
  1. It still requires entire segments to be contiguous in memory
  2. Potential for external fragmentation due to segment contiguity (?)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does TLB stand for?

A

Translation look-aside buffer

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

What do TLBs do?

A

Typically use content-addressable memory (CAMs) to quickly search for a cached virtual-physical translation

A TLB is basically a table with virtual address –> physical address map entries

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

What does CAM stand for?

A

Content-addressable memory

17
Q

What is the problem with relying on CAMs to make virtual address translation fast?

A

CAMs are limited in size. We cannot make them arbitrarily large.

18
Q

Why is mapping individual byte translations a bad idea?

A

Mapping individual bytes would mean the TLB would not be able to cache many entries (because CAMs are limited in size) and performance would suffer