Chapter Nine Notes Flashcards
Base and limit registers
- Define logical address space
- CPU must check every memory access generated in user mode to be sure it is between base and limit for that user.
Multistep processing of a user program includes (top to bottom)
1) Source program
2) Compiler or assembler
3) Object Module
4) Other object modules
-> linkage editor
5) load module
6) system library -> loader
7) dynamically loaded system library -> in-memory binary memory image
Compile time: 2)
Load time: 4) - 6)
Execution time: 7)
Logical address space
set of all logical addresses or virtual addresses
Generated by the CPU; also referred to as virtual address
Physical address space
set of all physical addresses generated by program corresponding to logical address
address seen by the memory unit
Contiguous Allocation
With contiguous allocation main memory is usually divided into two partitions:
- Resident operating system, usually held in low memory with interrupt vector
- User processes then held in high memory, each process contained in single contiguous section of memory.
Variable partition
allows for dynamic resizing of memory partitions for efficiency (sized to a given process’ needs)
First-fit
Allocates the first hole that is big enough
Best fit
Allocates the smallest hole that is big enough; must search entire list, unless ordered by size
Worst-fit
Allocate the largest hole; must also search entire list
Given memory partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212K, 417K, 112K, and 426K (in order)? Which algorithm makes the most efficient use of memory?
First-Fit:
212K is put in 500K partition.
417K is put in 600K partition.
112K is put in 288K partition (new partition
288K = 500K - 212K).
426K must wait.
Best-Fit:
212K is put in 300K partition.
417K is put in 500K partition.
112K is put in 200K partition.
426K is put in 600K partition.
Worst-Fit:
212K is put in 600K partition.
417K is put in 500K partition.
112K is put in 388K partition.
426K must wait
External fragmentation
As processes are loaded and removed from memory, the free
memory space is broken into little pieces.
* External fragmentation exists when there is enough total
memory space to satisfy a request but the available spaces are
not contiguous: storage is fragmented into a large number of
small holes.
50 percent rule
For every N allocated blocks 0.5 N blocks are lost, so unusable memory: 0.5 N/(0.5N + N) = 1/3
Internal fragmentation
Memory allocated to a process may be slightly larger than the requested memory. The difference between these two numbers is internal fragmentation aka unused memory that is internal to a partition.
Paging
a memory management scheme that allows a computer to store and retrieve data from secondary storage (usually a hard disk) in smaller, fixed-size blocks called “pages.” These pages are typically of equal size and are used to manage both physical and virtual memory.
Page table
The virtual address space is divided into fixed-size pages, and the physical memory is divided into frames of the same size. The operating system maintains a data structure called a page table, which maps virtual pages to physical frames. The page table keeps track of the correspondence between virtual and physical addresses.