1/14
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Memory management is essential to
optimize system performance, resource allocation, and protection.
Principal Requirements for Memory Management
Efficient Allocation and Deallocation: Allocating memory to processes in a way that maximizes space usage and minimizes fragmentation. Deallocating memory promptly when processes are terminated.
Protection: Ensuring each process has access only to its assigned memory space, safeguarding against accidental or intentional interference.
Relocation: Allowing programs to be moved in memory during execution without disrupting their functionality, enhancing flexibility and efficiency in resource usage.
Sharing: Enabling processes to share memory safely and efficiently, allowing data or code to be shared across applications or users.
Logical and Physical Organization: Structuring memory logically (for simplicity and modularity) and physically (to optimize space allocation and speed).
Memory Partitioning: Purpose and Techniques
divides memory into sections to efficiently allocate space to multiple processes. It serves to:
Prevent processes from overlapping in memory.
Allow better control over memory allocation.
Techinques:
Fixed Partitioning
Dynamic Partitioning
Buddy Systems
Fixed partitioning
Divides memory into fixed-size partitions. Processes are allocated to partitions based on size, though this can lead to internal fragmentation if a process doesn’t fully use its assigned space.
Dynamic Partitioning
Allocates memory based on the exact size needed by a process. This minimizes internal fragmentation but can cause external fragmentation as free memory becomes scattered.
Buddy System
Combines aspects of both fixed and dynamic partitioning by using power-of-two sized partitions that can be split or merged as needed. This helps manage fragmentation and allows flexible partition sizes.
Concept of Paging
memory management technique where both logical memory and physical memory are divided into fixed-size blocks. Logical memory is divided into pages, while physical memory is divided into frames. A page table maps each page to a corresponding frame in physical memory, allowing a program to load and execute across non-contiguous frames.
Advantages of paging
Simplifies memory allocation and management.
Reduces external fragmentation since fixed-size pages and frames fit well together.
Allows processes to grow or shrink in memory more flexibly.
segmentation
a memory management approach that divides a program’s memory into logical segments such as code, data, and stack. Unlike paging, these vary in size, and each has a unique base and limit address. This organization aligns with the program’s logical structure and allows for modular growth.
Advantages of segmentation
Improves protection and sharing, as segments can be individually managed.
Aligns well with the way programs are structured, providing a more intuitive way to manage memory for complex applications
Paging vs. Segmentation: Relative Advantages
Paging:
Eliminates external fragmentation by using fixed-size pages and frames.
Simplifies memory management since each page is of a fixed size.
Segmentation:
Provides a more logical structure that reflects the program's design, allowing greater flexibility in addressing code and data separately.
Offers improved protection, as segments can be independently protected or shared.
In practice, segmentation and paging can be combined in systems to leverage the benefits of both approaches.
Loading
The process of transferring a program from storage into memory for execution.
Loading can be:
Absolute: Places a program at a fixed memory address.
Relocatable: Allows a program to be loaded at various locations by adjusting memory references.
Dynamic: Only loads necessary parts of the program into memory as needed, optimizing space.
linking
Combines multiple object modules (compiled code) into a single executable file, resolving references and addresses between modules.
Linking can be
Static: Occurs at compile-time or load-time, where all modules are combined before execution.
Dynamic: Occurs at runtime, allowing shared libraries to be loaded into memory when needed, saving memory and enabling library updates without recompiling programs.