12. Intro to Memory Management Flashcards

1
Q

What is time multiplexing?

A

Sharing a resource by dividing up access to it over time.

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

What are three examples of time multiplexing?

A

CPU scheduling on a single-core system

Classroom scheduling using temporal scheduling

Car share programs

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

What is space multiplexing?

A

Sharing a resource by dividing it into smaller pieces.

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

What are three examples of space multiplexing?

A

CPU scheduling on a multi-core system (low granularity)

Memory management (high granularity)

Splitting up a cake

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

What are the two main steps of memory allocation?

A

First, a process requests large chunks of memory from the OS kernel
(is this the address space?)

Second, the process divides the available memory up using a process-level allocation library (like malloc)

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

Why can’t we just divide physical memory up between processes (direct multiplexing)?

A
  1. We are limited to the amount of physical memory on the machine. Too many processes means we’d run out of memory.
  2. There is the potential for fragmentation, which reduces the efficiency of allocation
  3. Potential for discontiguous allocations, which complicates the process memory layout
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the process memory layout concerned with?

A

It is concerned with how the process knows where its code and data are located.

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

What is fragmentation?

A

When a request for contiguous memory fails despite the fact that there is enough unused memory available (on the system)

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

What is internal fragmentation?

A

Fragmentation/unused memory inside an existing allocation

Ex: Firefox is given a block of memory but doesn’t use parts of it

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

What is external fragmentation?

A

Fragmentation/unused memory between existing allocations

(Ex: There is a small piece of unused memory in between the memory allocated for Firefox and the memory allocated for iMail)

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

Is it always feasible to splid data structures across multiple pieces of discontiguous memory?

A

No. For example, an int array data[10240] requires contiguous memory because of the way indexes are used to access elements within it.

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

What are the 5 main problems with direct multiplexing?

A
  1. We’re limited to the amount of physical memory on the machine
  2. We can get stuck with discontiguous allocations
  3. Potential for fragmentation, which reduces allocation efficiency
  4. Enforcing allocations (making sure the right process is accessing the mem address) requires checking permission for every memory access (very slow)
  5. Reclaiming unused memory leads to increased discontiguity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the 4 requirements for memory multiplexing?

A

Grant, enforce, reclaim, and revoke

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

What is the “grant” requirement for memory multiplexing?

A

The kernel should be able to allocate memory to processes statically (at startup) and dynamically (as needed)

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

What is the “enforce” requirement for memory multiplexing?

A

The kernel should be able to enforce memory allocations efficiently

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

What is the “reclaim” requirement for memory multiplexing?

A

The kernel should be able to repurpose unused memory without destroying its contents

17
Q

What is the “revoke” requirement for memory multiplexing?

A

The kernel should be able to stop a process from using memory that it was previously allocated

18
Q

What is the “grant” requirement a CPU?

A

CPU must be able to schedule a thread via a context switch

19
Q

What is the “enforce” requirement a CPU?

A

CPU must be able to interrupt a thread using a timer interrupt

20
Q

What is the “reclaim” requirement a CPU?

A

?

“This is new”

21
Q

What is the “revoke” requirement a CPU?

A

CPU must be able to reschedule a thread via a context switch

22
Q

Which abstraction is the memory management abstraction? (and how?)

A

The address space.

We provide every process with an identical view of memory that makes it appear plentiful, contiguous, uniform, and private

23
Q

What is the principle service (benefit) of the address space layout?

A

The uniformity of the address space simplifies the process layout.

It allows a process to always put things like static variables, the heap, and the stack at the same addresses

24
Q

Where is the process layout (convention) specified?

A

In the Executable and Linker Format (ELF) file

25
Q

Why don’t ELFs typically load process code at address 0x0?

A

To catch possibly the most common programming error, a NULL pointer problem.

We want to set up an environment where a pointer to 0x0 is not valid unless explicitly specified to be.