Flashcards
Memory Management
Flashcards do conjunto (26)
- 1OS Functions (in terms of Mem Manage)-Keep track of what parts of memory are being used, by who and when
-Decide which process to load into memory space when it becomes avaliable
-Allocate and deallocate memory - 2BINDING - Compile TimeDuring memory compilation, absolute mem address will be embedded into executable code. Program knows exactly from which addr to load
AD: requires min amount of set up time as knows where to find data
DIS: If mem space pre occupied by another program, collision will occur and program will override existing prog in mem - 3BINDING - Load TimeBinding is delayed until code loaded into memory. When program is completed, will be in relocatable format
i.e. program is size 4000 {0-4000}, when getting loaded into mem, loader says from 2000 onwards to 10000 there is free mem, so now address becomes 2000+0 -> 2000+4000 - 4BINDING - Execute TimeBinding Delayed until runtime. Process is moved during execution from one block to another.
- 5MMUHardware device that does the run-time mapping of logical (virtual) address to physical address
Handles:
Hardware management
OS management
Application management - 6SWAPPINGWhen a program is swapped out of memory and into backing store
i.e. P1 exists and executing; P2 comes along with a higher priority - If not enough free space, P1 swapped out into backing store as it is not doing anything anymore - 7SWAPPING (in detail)>CPU scheduler calls process to run -> calls dispatcher to see if process in mem [IF NOT AND not enough free mem], dispatcher swaps out one or more processes
DIS: If swapped out process was in middle of doing IO, there could be some issues
^^SOLUTION: latch job in memory while performing IO - 8Backing StoreThis is typically part of the hard disk and is used for paging, swapping, or to store info not currently in memory. Slower than main memory.
- 9LoadingProcess of bringing program into main memory so it can run
- 10Dynamic LoadingA program is broken up into modules; in dynamic loading, main module is loaded first, then the rest are loaded upon request.
AD: Unused modules are loaded which is for more efficient memory allocation - 11Dynamic LinkingLinking of library routines delayed until runtime. Libraries that are used to support submodules are not called in all at once - instead only when requested.
- 12MEMORY ALLOCATION TYPES [Contiguous, Non-Contiguous]Contiguous : memory is allocated in sequential blocks
AD: no overhead in address translation and memory executes faster
DIS: causes external fragmentation
Non-Contiguous: memory allocated in blocks scattered across in no particular order
AD: reduces memory wastage as empty blocks better utilised (as any block can be filled in any order)
DIS: has overhead with address translation and slower to execute process in this way - 13Memory MappingMapping occurs with the usage of a relocation register scheme which involves:
Limit reg := contains range of logical addr
Relocation reg:= value of smallest physical addr
E.g.
LA: 500-> Reloc Reg [min addr 4000] -> PS: 4500
Used to prevent user processes from accessing each other's memory - 14FragmentationExternal Fragmentation:
When a certain process cannot fit into free memory partition, but the collective total of all free spaces
^solution may be compaction, paging, segmentation
Internal Fragmentation:
When a process is allocated more memory than required, creating free unused space
^solution partition into variable sized blocks and use best fit - 15CompactionGroup together free memory into one large chunk so that there is more available space for contiguous processes
- 16PAGINGA potential solution to external fragmentation that involves partitioning physical mem into fixed sized blocks called FRAMES and partitioning logical mem into fixed sized blocks called PAGES
-Backing store also divided into fixed sized blocks size of frames
So in order to run program of n size pages, OS must find n free frames and loads program. Uses page table to translate logical to physical addr. - 17Implementation of Page TablesPage tables kept in memory
PTBR page table base reg - points to page table
PTLR - length register shows size of table
In this scheme, every data instruction access requires TWO mem accesses:
1) page table access
2) data/instruction access
This TWO-MEM access issue is overcome by using associative registers TLB - 18Associative Register TLB ITLB is a memory cache that is used to reduce the time taken to access user memory. Part of chips MMU. Stores recent translations from logical to physical memory addresses, if requested page is in TLB, it counts as a 'hit' and thus only the minimal access time is incurred
- 19Associative Register TLB II (ASID)ASID identified a process. ASID for running program must match ASID for TLB entry.
-Used for address space protection for a process. Allows TLB to contain entries for diff processes at the same time - 20Memory ProtectionImplemented by putting a protected bit in each frame. A valid-invalid bit is attached to each entry in the page table
Valid = associated page is in processes logical addr space thus legal.
Invalid = not in LAD (traps OS)
-One bit can be dedicated to read/write only - 21Purpose of modify bitDirty bit is set when process writes to (modifies) this memory. Bit indicates that the associated block of memory has been modified and not saved in storage yet.
- 22TYPE of page tables [Hashed Page Table]>Virtual page number is hashed into page table
>Each element contains virtual page num, value of mapped frame, pointer to next element
MEM ACCESS:
Even though for one mem access, it is quadrupled, still within reasonable bounds
AD: Smaller table size AND fast lookup speeds
DIS: Hashing collisions can occur - 23TYPE of page tables [Inverted Page Table]OS maintains one global page table for all processes. Because of all this extra info, need PID to identify which info belongs to certain processes.
Difference: In case of ordinary, page numbers are the index and the content at that index is a frame number. In inverted, the page number is the content and the frame number is the index of the entry
AD: Takes up less space
DIS: Look up time increased because have to look for processes and corresponding pages - 24TYPE of page tables [Standard]Maps virtual pages onto physical frames.
Each process has a page table associated with it
DIS: each page table consists of millions of entries, and thus a large amount of physical memory is consumed - 25Shared Pages-Advantage of shared pages is that with paging, can share common code
-Reentrant code is code that is never modified after execution - 26SegmentationAnother solution for external fragmentation
Segmentation is memory scheme that supports view of the user - program is collection of segments (logical units like functions, etc.)
Each segment has a name, length and address. Consists of tuple
STBR - points seg to location in register
STLR - indicates number of segments used by program
Informações
- Descrição
- FlashCards sobre Memory Management, criado por Eric Wojcik em 13-06-2018.
- Criado por
- Eric Wojcik
- Visualizações
- 2
- Avaliação