Memory management Flashcards
What is memory management?
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
Compare 32 bit to 64 bit
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
What is the Number of Possible Values
In 4-bit system = 24 = 16. The maximum value is 15 (= 24 – 1).
What is Memory Space
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
What is a logical address?
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
What is a Physical address?
This is the actual address where the data/process is stored in the hardware. CPU/OS does not recognise this address
What is the MMU
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
What is a Page Table?
Stored in the MMU. It is a table (hash) which maps each logical address to a physical address
What is a Page Fault
Error that occurs when OS is trying to access an address which is not in Page Table
What is Paging
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
What is segmentation?
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)
What is Memory allocation?
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.
What is memory fragmentation?
Problem of memory becoming unusable even though it is available. There are 2 types of fragmentation: External and Internal
What is external fragmentation?
There are enough space in the memory but they are not contiguous so it cannot be used. We can solve this through Compaction
What is Compaction?
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