Summary 2 Flashcards
Memory management
the technique for mapping virtual address spaces to
physical memory
Physical memory
memory that is directly accessible to the CPU; operates at
high speed, but typically offers lower capacity than storage
Disk
a storage device that uses a magnetic storage mechanism. Not all data fits
into physical memory, so the disk holds data until it is pulled into physical
memory
Fixed partition scheme
a strategy for translating virtual to physical addresses
in which we divide the memory into partitions such that one process is loaded per
partition and queue processes that are waiting to be loaded into memory. Uses a
fixed offset to convert between physical and virtual addresses
Base and limit registers
strategy for translating virtual to physical addresses
in which the base register contains the value that gets added to the virtual
address to determine the physical address, and the limit register contains the
highest address that the program cannot surpass. Requires hardware support to
implement.
Bitmaps
in tracking free space in memory, a bitmap is a vector in which each
digit is 1 or 0 depending on whether a given memory chunk is free or not
Linked list
in tracking free space in memory, the elements of the linked list
represent blocks of memory that are free
Worst-fit
a memory allocation scheme that finds the largest block of free
memory possible and stores the process in it
Best-fit
a memory allocation scheme that finds the smallest hole which is large
enough to fit the process and stores the process in it
First-fit
a memory allocation scheme that puts the process in the first
discovered hole of free memory that is large enough to fit the process
Internal fragmentation
internal to an allocated space, internal fragmentation is
where a process is allocated more bytes than it uses
External fragmentation
space that the OS is aware of, but that is too small to fit
new processes
Page
A continuous portion of memory that is treated by the operating system as
a single unit of storage
Slab allocation
break large chunks of memory given to a process by the Buddy
algorithm into smaller units for allocation
Object caches
freed objects are stored in a cache in case they are allocated
again, rather than freeing them for allocation to other processes
Virtual memory
virtual memory is the memory that is allocated to a process for storing
its in-memory state. It is considered “virtual” because at creation, it is not yet mapped
into physical memory locations. Virtual memory is broken down into the code, data,
stack, and heap segments, creating a standardized memory representation between all
processes. Virtual memory offers the OS a complete separation of logical and physical
addresses
Segmentation
divides the address space into variable sized segments or logical
addressable units. These include the code, stack, heap, and data segments
Virtual memory page
a contiguous block of virtual memory addresses of a fixed range,
which is the same as page frames. A page is the smallest unit of addressability to virtual
memory available to the OS for memory management. Pages will not contain addresses
from different segments of virtual memory
Page frames
a contiguous block of physical memory addresses of a fixed range, which
is the same as the size of virtual memory pages. Virtual memory pages swapped into
main memory from storage are mapped to page frames.
Paging
Paging is the technique by which the OS swaps in various virtual memory
pages as they are needed as virtual memory is typically much larger than physical
memory.
Memory Management Unit (MMU)
translates virtual addresses to physical addresses.
Divides the virtual address space into pages
Disk controller
enables the CPU to communicate with the disk storage
Swap file
space in the hard disk that operates as an extension of the RAM for portions
of the process virtual memory that do not fit in RAM. Pages can be stored in the swap
file to create room for other processes to execute in RAM.
Page table
a table exists for each process to map from a page number to page frame
○ Validity bit: stored in the page table; 1 if a page is in memory and 0 if it is not
○ Protection bit: stored in the page table; set to read, write, or execute depending
on the segment
○ Reference bit: stored in the page table; allows us to detect pages that are
frequently used by setting this bit to 1 when a page is accessed
○ Modified (“dirty”) bit : stored in the page table; set to 1 if a page has been
written to and 0 otherwise (on pure reads)
Multi-level paging
divide up the virtual addresses such that the highest order group
indexes into a top level page table, the second highest order group indexes into the next
level page table, and so on. When looking up in a multi-level page table, the
corresponding bits of the page number are used to index into each level until we get to
the page table of interest. This strategy is used because virtual memory is often larger
than physical memory and each process has its own page table, thus the total amount of
memory required to store page tables needs to be managed.
Transaction lookaside buffer (TLB):
small cache maintained within the MMU hardware
to lookup pages before we go to main memory to retrieve the page table. The TLB is
associative memory.
Inverted page table
stores entries in the form of (page-frame, process ID, and page
number), which is like a hash table, to help find the desired page frames and avoid a
linear search of the page table
Offset
in the offset number, the lower order bits correspond to the offset at which we
want to access addresses within a given page, and the higher order bits represent the
page we want to access