Memory Management Flashcards
Compile-time address binding
The location of variables in memory is known in compile time, hence thair address can be static.
Load-time address binding
The location of program data in memory is known when loading the program so it can be set.
Execution-time addresas binding
The address of the programs data can change while execution/different states of execution. So there needs to be a base and limit registers that declare the process’ memmory block and eveyrthing is in relation to it.
Memmory management unit
Hardware device that maps virtual address to real physical address. Does so by adding the storing a relocation registor which is basically the offset in which the process’ address space in physical memmory starts.
Contiguous Allocation
Memory is basically just a lot of addresses. So when a process arrives you want to be able to find a continous chunk of memory in the needed size. To do this, the OS maintins a list of all allocated partitions and free partitions(also called holes).
External Fragmentation
There is enough availbale memory to accommodate a process but it is not contiguous. Can be reduced by compaction.
Internal Fragmentation
Allocated but unused memory.
Paging
Divid physical memory into fixed size frames (512-8,192 bytes). And logical memroy into same sized pages. Allocate just the needed pages for a program, and map logical to physical addresses with a page table.
Page table implementation (PTBR, PRLR)
Page table is kept in main memory.
PTBR - Page table base register: points to the page table.
PRLR - Page table length register - the size of the page table.
Each data access needs to memory accesses. One to page table and then to the actual address.
TLB
TLB - translation look-aside buffer.
A fast hardware cache for page tables lookups.
When needing to translate a logical to physical address, first search the page in TLB, if not there then look in actuall page table.
valid/invalid bit
Each frame in memory has a protection bit that inidcates if the frame is currently in main memory. If it is 1 then it is in main memory, If 0, it is in storage or doesn;t exist and needs to be loaded.
Protection bits
Bits that specify the permissions to a certain page: read, write execute and user/kernel bits.
Shared code
Only one copy of read only code. The shared code must appear in the same location in the logical address space of all processes so the fixed addresses don’t get messes up.
Hierarchical Paging
Instead of having one large page table, a process has multiple levels of page tables. Each level points to a lower level with the last one storing the actual adress. This way, you don’t need the entire page table allocated but only the lower levels you actually need.
Hashed Page Table
- Extract virtual page number from address
- Hash it to find correct bucket
- Search linked list for matching virtual page number
- If found, use the corresponding physical frame number
- If not found, generate page fault
Inverted Page Table
Each physical frame has an entry, and contains the process id, and virtual address it is linked to. When looking up a virtual page for a process, you go through the table finding entry that matches the ID and virtual page. This is usauuly sped up by a hash table to make lookup faster.
Segmentation
Each programs logical space is split into segemnts represting different things such as: code, data, stack, heap. Each segemnt has its own contiguous space in memory and is mapped using a segmentation table.
MULTICS
Segmentation with paging. A segmentation table entry doesn’t contain the base address of the physical segment but rather the base address of a page table for the segment.