Memory management Flashcards

1
Q

What is memory management?

A

Efficient ways to dynamically allocate portions of memory to processes at their request, and freeing it for reuse when the allocated memory is no longer needed. It only manages RAM. We need to do memory management because we want to be able to run as many process as possible using the limited amount of memory available

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

Compare 32 bit to 64 bit

A

In 32 bit, the amount of data that can be transferred from RAM to CPU in one clock cycle is 32 bits, and the maximum memory it can have is 4GB. In 64 bit, the amount of the data that can be transferred from RAM to CPU in one clock cycle is 64 bits, and the maximum memory it can have is 16EB. Thus, 64 bit system is faster and can have more memory than the 32 bit system

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

What is the Number of Possible Values

A

In 4-bit system = 24 = 16. The maximum value is 15 (= 24 – 1).

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

What is Memory Space

A

Also known as Memory Address. It is defined by 2 values: Base and Limit. Base value defines the location where the process is loaded in the RAM. It is written in hexadecimals. Limit value defines the size of the memory allocated to that process

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

What is a logical address?

A

Also known as Virtual Address. This is the address known to CPU & OS. The reason we need to have logical address is because a process may be divided into parts and each parts may be located at various place (not contiguous) in the RAM. By only allowing OS/CPU to deal the address in terms of logical address means that OS/CPU doesn’t have to care how and where each part of the process is actually stored in the RAM/HDD

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

What is a Physical address?

A

This is the actual address where the data/process is stored in the hardware. CPU/OS does not recognise this address

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

What is the MMU

A

Memory Management Unit. It is a hardware device located between CPU and RAM. Sometimes, it is part of the CPU. Its function is to manage memory allocation in both RAM and Virtual Memory, and to translate logical address to physical address and vice versa

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

What is a Page Table?

A

Stored in the MMU. It is a table (hash) which maps each logical address to a physical address

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

What is a Page Fault

A

Error that occurs when OS is trying to access an address which is not in Page Table

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

What is Paging

A

Methods for breaking memory into same size blocks called pages. With Paging, a process can be broken into parts and each parts does not have to be located next to each other (contiguous). Thus, it reduces storage and external fragmentation problem. More importantly, paging allows processes to share common code and so reducing the amount of memory required

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

What is segmentation?

A

Methods for breaking memory into logical pieces. Each piece represent a group of related information, e.g. Text segment, Data segment, Heap segment and Stack segment. The size of each segment (logical blocks) may vary. Each block must be located next to each other (contiguous)

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

What is Memory allocation?

A

Algorithms used to allocate process into the memory. There are 3 memory allocation algorithms: 
* First-Fit: Find the first hole that is big enough for the process
* Best-Fit: Find the smallest hole that fit the process
* Worst-Fit: Find the biggest hole that fit the process
First-Fit is the Fastest out of all three.

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

What is memory fragmentation?

A

Problem of memory becoming unusable even though it is available. There are 2 types of fragmentation: External and Internal

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

What is external fragmentation?

A

There are enough space in the memory but they are not contiguous so it cannot be used. We can solve this through Compaction

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

What is Compaction?

A

Automatic ways to reallocate current processes so that all freely available space is next to each other. Effective and Forced compaction is done during Disk Defragmentation

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

What is internal Fragmentation?

A

Unusable memory because a process has requested memory that is more than it needed. OS cannot solve this. The programmers must redesign the program so that it is allocated the amount that it really requires

17
Q

What is virtual memory?

A

Technique that allows the execution of processes which require larger memory than the actual size of the RAM. It is done by reserving some hard-disk space to be used as a memory

18
Q

Advantages of VM

A

Can run a program which requires larger memory than the size of the RAM. More programs could be run at the same time. Less I/O needed. Faster I/O time and Programs would run faster

19
Q

What is memory swapping?

A

Process for swapping in/out process/data in RAM to the HDD/Virtual Memory. There are 2 types of swapping:
* Swapping process that have been terminated from RAM back to HDD
* Swapping out PART of a process that is unused from RAM to Virtual Memory. Swapping in PART of a process that is needed from Virtual Memory to RAM (Using Demand Paging). This swapping is only done when the process is idle

20
Q

What is demand paging?

A

: Technique used to decide which pages of a process need to be moved from Virtual Memory to RAM and vice versa