Memory management is the function of a computer operating system responsible for managing the computer's primary memory.
The memory management function keeps track of the status of each memory location, either allocated or free. It determines how memory is allocated among competing processes, deciding who gets memory, when they receive it, and how much they are allowed. When memory is allocated it determines which memory locations will be assigned. It tracks when memory is freed or unallocated and updates the status.
The basic functionality of the three memory allocation schemes presented in this chapter: fixed partitions, dynamic partitions, relocatable dynamic partitions
Best-fit memory allocation as well as first-fit memory allocation schemes
How a memory list keeps track of available memory
The importance of deallocation of memory in a dynamic partition system
Single-User Contiguous Scheme Each program loaded in its entirety into memory and allocated as much contiguous memory space as needed. If program was too large -- it couldn't be executed. Minimal amount of work done by Memory Manager.
Hardware needed:
1) register to store base address;
2) accumulator to track size of program as it is loaded into memory.
Algorithm to Load a Job in a Single-user System
1. Store first memory location of program into base register
2. Set program counter equal to address of first memory location
3. Load instructions of program
4. Increment program counter by number of bytes in instructions
Fixed (Static) Partitions Attempt at multiprogramming using fixed partitions one partition for each job size of partition designated by reconfiguring the system partitions can’t be too small or too large. Critical to protect job’s memory space. Entire program stored contiguously in memory during entire execution. Internal fragmentation is a problem.
Dynamic Partitions-Available memory kept in contiguous blocks and jobs given only as much memory as they request when loaded. Improves memory use over fixed partitions. Performance deteriorates as new jobs enter the system fragments of free memory are created between blocks of allocated memory (external fragmentation).
Dynamic Partition Allocation Schemes First-fit :
Allocate the first partition that is big enough. Keep free/busy lists organized by memory location (low-order to high-order). Faster in making the allocation. Best-fit : Allocate the smallest partition that is big enough Keep free/busy lists ordered by size (smallest to largest). Produces the smallest leftover partition. Makes best use of memory.
Relocatable Dynamic Partitions Memory Manager relocates programs to gather all empty blocks and compact them to make 1 memory block. Memory compaction (garbage collection, defragmentation) performed by OS to reclaim fragmented sections of memory space. Memory Manager optimizes use of memory & improves throughput by compacting & relocating
Compaction Steps Relocate every program in memory so they’re contiguous. Adjust every address, and every reference to an address, within each program to account for program’s new location in memory. Must leave alone all other values within the program (e.g., data values)
Program in Memory During Compaction & Relocation- Free list & busy list are updated free list shows partition for new block of free memory busy list shows new locations for all relocated jobs Bounds register stores highest location in memory accessible by each program. Relocation register contains value that must be added to each address referenced in program so it can access correct memory addresses after relocation.
Key Terms address best-fit memory allocation bounds register compaction deallocation dynamic partitions external fragmentation first come first served first-fit memory allocation fixed partitions internal fragmentation K multiprogramming relocatable dynamic partitions relocation register.
trap_sexygren06

No comments:
Post a Comment