1.4 Memory Management Flashcards

1
Q

Dynamic Memory Allocation

A

OS allows provides mechanism for programms to Dynamically allocate memory via system libraries and special functions

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

Memory Fragmentation

A

Inefficient splitting of memory space into small chunks in the main memory or on a hard disk.

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

Allocation Strategy

A

This is an algorithm that decides which free resource (here, memory region) is allocated to which request.

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

First Fit

A
  • Allocate first free matching Block
  • Simple and fast
    But
  • Small free chunks accumulate at small adresses
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Next fit

A

Same as first, but continue search at last allocation

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

Best fit

A
  • Allocate the block that leaves the smallest reminder
    But
  • Allocation of many small residual gaps
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Worst fit

A
  • Allocate the block that leaves the largest reminder
  • Remaining gaps remain large and therefore easy to allocate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is memory protection and why is it important?

A

Ensures that multiple processes are only accessing designated address space.

Process isolation
* Malfuntioning programs can only impact own address space

Data security
* Prevents unauthorized access to sensitive data

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

How is memory protection archieved?

A

Hardware support of the CPU
* Detects attempts
* Raises exception
* Triggers OS to stop process

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

Boundary registers

A
  • Part of the CPU Check validity of memory address accessed by process
  • Uses start and end information of process control block
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Recap: What happens if process violates memory boundaries?

A
  1. Memory Access violation detected by Boundary registers via process control block
  2. Boundary registers promption CPU to hand over CPU to hand over control to OS
  3. Corrective action
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which part of the computer uses logical and which part physical addresses to acces memory?

A
  • Address bus, physical
  • CPU and programs, logical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which part is doing the conversion of logical to physical addresses?

A

MMU

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

MMU

A
  • MMU is part of the CPU
  • Conversion of virtual to physical addresses
  • Consists of two registers: Base register and Limit register
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Base Register

A
  • Stores starting physical address of programm memory space
  • When programs logical address is generated, it assumes 0
  • MMU adds value in base register to logical address to determine physical address
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Limit register

A
  • Contains size of programms address space
  • Checks allowed memory range
  • Memory protection
17
Q

Benefits of Logical addresses

A
  • Allow programms to be written and stored as if running and stored as dedicated block, starting from 0
  • simplifies programming
  • flexible memory management
  • Secure Multitasking
18
Q

What is the Disadvantage of Virtual Memory Addresses and how can it be mitigated?

A
  • Contingious memory space is required
  • This can only be achieved if there is enough space in immediate physical range

Mitigation:
Virtual memory Addresses by way of paging

19
Q

Paging

A

With this method of memory management, the main memory is divided into pages (in the form of tables) and managed by the operating system in cooperation with the MMU.

20
Q

Memory Page

A
  • Blocks of a fixed length in the virtual address space used by processes, managed through virtual memory management techniques like paging.
21
Q

Page Frames

A

Physical memory block in Main meory

22
Q

Page Tables

A

In virtual memory management with paging, address translation is performed via page tables, which store, for each process, which of its memory pages are located on which page frame within the main memory.

  • Every Process has its own Page Table
23
Q

TLB

A

Translation Lookaside Buffer
* Temporary storage of recent table entries
* Faster Address Translation

24
Q

What are the three steps for converting virtual addresses to physical ones?

A
  1. Identify Memory Page
  2. Locate Page frame via MMU and page tables for Mapping
  3. Calculate Physical Addresses
25
Q

Demand Paging

A
  • Links virtual memory addresses with lager hard disk storage
  • Pages only read into memory if needed
  • Moved if no longer in use
26
Q

Page fault

A
  • MMU does not find match in page tables
  • OS steps in:
    1. Checks problem
    2. Loads Data if needed
    3. Updates and continues
27
Q

Swap Space

A

When no more free space in memory, OS makes space by moving unused data back to Hard Disk to:

SWAP SPACE
* part of hard Disk used for temporarily storing Data

28
Q

FIFO

A

First In / First Out
* Page that is longest in main memory

29
Q

LFU

A

Least frequently used
* Page that is least frequently used

30
Q

LRU

A

Least Recently Used
* Page not Accessed for longest

31
Q

What is the problem with the main Replacement strategies and how to mitigate?

A
  • Requires recording of information
  • Massive administrative effort by the OS

Mitigation
* NRU

32
Q

NRU

A

Not Recently used
* MMU sets bit as flag in page table if page address has been written to or read by process (Accessed)
* If content was changed by write access (Dirty)

  • OS periodically deletes bits every few time slices
  • Page eradication based on priority
33
Q

Describe the role of a Memory Management Unit (MMU) in the process of converting logical addresses to physical addresses.

A
  1. The Memory Management Unit (MMU) plays a crucial role in converting logical addresses to physical addresses.
  2. It has two registers that store the start address of the program (base register) and the length of the address range of the process (limit register).
  3. The MMU continuously converts logical addresses, which always start at address zero, to physical addresses by adding the content of the base register.
  4. Thus, it ensures the successful conversion of addresses before they are put on the address bus.
34
Q

What is the role of the interrupt controller in the mechanism for interrupt handling in a preemptive multitasking system?

A

It triggers an interrupt when the hardware alarm time expires, thus allowing the OS to regain control over the CPU?

35
Q

Apply the concept of Virtual Memory Addresses and briefly discuss the significance of the MMU in mapping the logical addresses to physical addresses in the computer memory.

A
  1. The concept of Virtual Memory Addresses enables the use of memory space that exceeds the actual physical memory of a computer by using a method called paging.
  2. The Memory Management Unit (MMU) plays a crucial role in this context. It is responsible for the conversion of logical addresses (sometimes called virtual addresses) into physical addresses.
  3. It does this in a granular manner, using fixed-length blocks known as memory pages. Using tables, the MMU maps these pages to the physical memory of the computer.
  4. The importance of MMU therefore lies in its ability to effectively manage and utilize the computer’s memory, ensuring an efficient use of the limited physical memory and allowing processes to run smoothly even when they require memory space that exceeds the physical memory.
36
Q
A
37
Q

Describe the role of the Translation Lookaside Buffer in the memory management system and discuss its importance in the address conversion process.

A
  • The Translation Lookaside Buffer (TLB) is essentially a fast associative cache that stores recently used table entries for the MMU, facilitating a faster address conversion process.
  • The table entries stored in the TLB allow the MMU to translate addresses without needing to search through the actual page tables, given that the addresses are moving within a page. This is particularly useful because it speeds up the operation of the effects of the MMU in translating virtual addresses into physical addresses.
  • By storing table entries in the TLB, the system avoids having to access the main memory every time an address translation is needed, saving time and enhancing the overall efficiency of the system. Therefore, the TLB plays a vital role in optimizing the process of address conversion in a system that employs virtual memory addresses.
38
Q

Which one of the following allocation strategies tends to leave many small, residual gaps?

A

Best Fit