Click on Download Button to Download 22516 Operating System Unit 5 Notes PDF
Memory
management is a crucial function of the operating system, ensuring optimal
utilization of the computer's primary memory, or RAM (Random Access Memory).
It's responsible for managing both the physical and logical aspects of memory.
Functions of Memory
Management:
- Process Isolation: Ensure that each process
runs in its own memory space, preventing it from affecting another process
unintentionally.
- Automatic Allocation & Management:
Efficiently and dynamically allocate memory as needed, and reclaim it when
not in use.
- Support for Modular Programming: Allow
programs to be broken into smaller pieces or modules.
- Protection & Access Control: Ensure that
a process can't access memory locations that haven't been allocated to it.
- Long-term Storage: Some memory contents need
to be kept for prolonged periods, even beyond a power cycle.
Key Concepts &
Techniques:
- Contiguous Memory Allocation: Assigning a
single contiguous block of memory to a process. This method often leads to
fragmentation.
- Fragmentation:
- Internal Fragmentation: Memory gets
wasted inside the allocated region due to block size allocation
discrepancies.
- External Fragmentation: Free memory
blocks are separated by allocated blocks, leading to scattered unusable
memory chunks.
- Paging: Memory is divided into small
fixed-sized blocks called pages. When a process needs to be executed, its
pages are loaded into any available memory frames, not necessarily
contiguous. This technique helps to eliminate external fragmentation.
- Segmentation: Memory is divided into
variable-sized blocks based on the different segments of a program (like
data, code, stack). Each segment is loaded into memory whenever needed.
This method can still experience external fragmentation.
- Virtual Memory: An abstraction that provides
an "idealized abstraction of the storage resources that are actually
available on a given machine." It allows processes to execute even if
they're partially in primary memory. Techniques:
- Demand Paging: Only the required pages of a
process are loaded, and others are loaded as needed.
- Page Replacement Algorithms: Determine
which page to replace when a new page needs to be loaded into memory
(e.g., LRU - Least Recently Used).
- Swapping: Moving processes in and out of
memory to the backing store (usually a disk).
- Memory Allocation Strategies:
- First Fit: Allocate the first available
block of memory that's large enough.
- Best Fit: Allocate the smallest available
block of memory that's large enough. This can lead to maximum external
fragmentation.
- Worst Fit: Allocate the largest available
block of memory. Assumes that the process will grow in the future.
- Memory Protection: Utilizing registers to
define the start and end of allocated memory, ensuring one process doesn’t
overwrite the memory of another.
Conclusion:
Memory management in operating
systems ensures efficient utilization of the computer's primary memory. Proper
memory management ensures that processes run smoothly, efficiently, and without
interfering with each other, leading to better system performance and
stability.
Ggg
ReplyDelete