Topic 12 – Memory management Flashcards
describe what
reloaction
is
this is a mechanism provided by the memory management module that enables a process to be loaded anywhere in memory and still be able to function
note
- this is essential in cases where programs may be written to use the same addresses in memory
- to enable this there will ususally be some implementation of a virtual memory system
name 4
tasks that the memory management modue
must carry out in order to provide a multitasking environment
the tasks this carrys out are:
- Allocating memory
- Relocation
- Protection
- Dealing with limited memory size
describe the linux file
/proc/swaps
this is a file that contains details about the swap spaces that are available such as partition and file swaps.
describe the following state:
Modify bit
Reference bit
1
1
what state are the modify bit and reference bit in when:
Page modified and referenced
(dont swap highly likely to be used again)
what is
paged virtual memory
this is a modern approach that operating systems use to handle memory
it invloves slicing memory into what are known as pages typically one page will be 4KiB
it also involves processes being alloacted virtual memory and the MMU will always translate to physical addressses
TRUE
each process will have its own page table
true/false
each process has its own page table
this is a memory address that is used by an application program and executed by the processor
it does not correspond to the real location of the resource in memory but will later be mapped to a physical memory address represnting where the resource actually exists in memory
what is a
logical/virtual address
this involves:
- logical/virtual memory addresses being sent to the processor by an application programs
- the processor executes and sends the logical address to a component built into the processor known as the memory mangement unit (MMU)
- the memory management unit (MMU) will translate the logical memory addresss to the physical memory address

how does a
virtual memory system
operate in 3 steps
false
the contents of the Translation look-aside buffer (TLB) is not saved upon a context switch.
instead it is flushed and repopulated for the new process
true/false
is the contents of the
Translation look-aside buffer (TLB)
saved on a context switch
name 2 instances upon which a
page fault can occur
this can occur when either:
- The page entry is part of the logical address space but it is currently in swap space
- The page may not be in the logical address space of the process; for example, a bug may cause a reference to an address outside the process’s address limit.
describe the following state
Modify bit
Reference bit
1
0
what state are the modify bit and reference bit in when:
Page is modified and not referenced
(can be written to swap as is unlikely to be used again, this could be initialisation instructions or error handling instructions page)
when this occurs:
- an interrupt will occur
- the page fault handler will deal with the page fault
what events are called when a page table entry is marked as invladid
this is a part of the operating system kernel and is charged with the management of memory
what is the
Memory Management Module
This command is used to show information about virtual memory and various events such as interrupts
describe the linux command
vmstat
what is the default unit
used by the linux free command
the default unit that this uses is
kibibyte
this is cache that is dedicated to holding entries from a page table.
it is used by the Memory Management Unit so that it can translate pages from here instead of from main memory.
if the MMU always had to go to main memory then it would be a bottlneck for the CPU
what is the
Translation look-aside buffer (TLB)
the execution process for this is as follows:
- All processes will be allocated logical memory and they will access their data using logical addresses
- When a program executes a logical address on the CPU the MMU will translate it using a page table
- If the logical address was 3D49 then the MMU would use the page number 3 as an index to the page table
- index 3 of the page table will tell the MMU the physical page number inside physical memory
- The MMU then combines the found physical page number with the offset of the logical address to reveal the true physical address in memory

describe the execution process of
paged virtual memory
what events are called when a page table entry is marked as invladid
when this occurs:
- an interrupt will occur
- the page fault handler will deal with the page fault
this is overcome by the operating system by
making use of a modify bit (dirty bit) and a reference bit which are stored with each entry in the page table and is updated by the MMU
how does the operating system appropriately decide which pages should be swapped in order to overcome swapping problems
what are 4 advantages and 1 disadvantage of paged virtual memory
advantages
- efficeient swapping -Swapping occurs in small chunks instead of entire processes
- better space utilization - Memory is allocated in small chunks so space is not wasted
- flexible reloction - Relocation is more flexible since it can be done on a page by page basis. instead of relocating an entire block of instructions the instructions that overlap can be paged and moved and the rest of the instructions that do not overlap can be left as is
- increased protection - protection can also be applied on a page by page basis and allow shared access to specific pages reducing scope for error or malicious code to attack
Disadvantages:
- page table size - Because page sizes are so small a page table for a process can grow extremely large. However some MMU hardware will allow for larger page sizes such as 1MiB or 1GiB.
this is a file that contains details about the swap spaces that are available such as partition and file swaps.
describe the linux file
/proc/swaps
if this was the case it would be catastrophic and a bottlneck for the cpu since the memory management unit would have to make two trips to main memory every time an instruction was executed
- To translate the logical address to the physical address using the page table in main memory
- To extract the instruction or data from main memory once the physical address has been translated by the MMU
what would happen if the
Memory Mangement Unit (MMU) did not have the dedicated Translation look-aside buffer (TLB)
what is the
Translation look-aside buffer (TLB)
this is cache that is dedicated to holding entries from a page table.
it is used by the Memory Management Unit so that it can translate pages from here instead of from main memory.
if the MMU always had to go to main memory then it would be a bottlneck for the CPU
what were the
base and length registers
historically used for
these were historically used so that a virtual memory system could be implemented





