Memory: Basics and Segmentation Flashcards

1
Q

In the early days a process took the whole memory. With multiprogramming and time sharing this was changed.

  • What sort of problems occurred?
  • How could those problems be fixed?
  • What new problem occured through the fix?
A
  • Processes took in the beginning the full memory space. We have to store the processes somewhere outside of memory. To change processes is highly inefficient.
  • Solution: Multiple processes in memory at the same time
  • New problem: Protection is required.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Keypoints of virtual address spaces :

  • What does it contain?
  • virtual addresses
  • Protection
A
  • Full memory state (code, data, stack, heap)
  • Virtual addresses which do not correspond to physical address (virtual address space can be larger than physical)
  • Protection through isolation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Target goals of virtual address spaces?

A
  • Efficiency: Memory has to be highly efficient
  • Transparency: Illusion that a process has access to the full memory space (We don’t want to work with memory problems while coding in C)
  • Protection: A process should only have access to his memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  • What is the virtual address space exactly?

- Where is it stored?

A
  • The virtual address space is for every process. It represents the memory space to give the process the meaning that it has all memory zur Verfügung.
  • It is stored in memory (or HDD -> swapping). Memory is split between processes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  • What is a virtual address?
  • What is a physical address?
  • What are the differences?
A
  • A virtual address to process data in memory. This has to be translated to a physical to be accessed.
  • Physical address can be accessed on the fly.
  • The process has most of the time not access to the physical address to reduce complexity for the programmer.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Address Translation:

  • What is it?
  • What are the roles of the OS and the hardware?
A
  • This is the tranlsation from virtual address to physical address
  • OS: Manages memory, knows which part belongs to which process
  • Hardware: Memory Management Unit (MMU) translates efficiently.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is “base and bounds”?

A
  • First approach to address translation
  • Uses 2 HW registers: Base and Bound (Limit)
  • Programs are compiled to start at address 0
  • Base starts at physical address and bounds = base + size of address space
  • Physical address = base + virtual address
  • If physical address > bounds -> Fault
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  • What is external fragmentation?
  • How does it happen?
  • What is the problem?
A
  • If there is memory space available but distributed in small chunks all over the place.
  • By user memory allocation.
  • If we got 24 Kb free memory, which is all over the place, we cannot give a process 20Kb memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the problem with compaction as solution for external fragmentation?

A

Compaction compacts the memory after each memory switch (free to free and used to used.

  • This costs a lot of time
  • impossible (No control over user assigned memory)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a possible solution to external fragmentation?

A

Splitting and Coalescing.

  • Free frame linked list is used to keep track on memory
  • By memory request, some free memory is split.
  • When memory is returned, it can be coalesced into a bigger chunk of memory (if it is at the same address)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the problems of dynamic relocation (e.g. base and bounds)?

A
  • Internal fragmentation

- Hard to manage virtual address space that is bigger than physical

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

- What problem does it solve?

A
  • Segmentation divided the virtual address space into segments. Each segments has its own base and bounds registers/variables whatever.
  • It solves the problem of dynamic relocation: Internal fragmentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does the addressing work with segmentation? How does the hardware know which segment belongs to which virtual address?

A

Use the first 2 bits to number the segments (or more if there are more than 4 segments). This splits the address into segment number and offset.

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

Segmentation:

  • What is a problem with the stack segment and how is it solved?
  • How can we share segments?
A
  • The stack grows negative. Therefore we need to know in which direction a segment grows.
  • We need an additional protection bit to show if we can savely read from it (because it is never written to) or not.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly