Assignment: CA-2 JAN 2205
1. Explain the various memory management techniques used in modern operating systems
Modern operating systems use several memory management techniques to optimize performance
and resource utilization. These techniques include:
1. **Contiguous Memory Allocation**: Allocates a single contiguous block of memory to each
process. It's simple but leads to fragmentation issues.
2. **Paging**: Divides memory into fixed-size pages and divides processes into pages of the same
size. Physical memory is divided into frames, allowing non-contiguous allocation, reducing
fragmentation.
3. **Segmentation**: Divides the process into segments like code, data, and stack. Each segment
has a base and limit, offering logical division of memory.
4. **Virtual Memory**: Allows execution of processes that may not be completely in main memory. It
uses disk space as an extension of RAM, enabling larger programs to run.
5. **Demand Paging**: Loads pages into memory only when they are needed, reducing memory
usage and improving efficiency.
6. **Swapping**: Temporarily moves inactive processes from RAM to disk to free up memory for
active processes.
These techniques help ensure efficient memory utilization, support multitasking, and prevent
memory leaks and overflows.
2. Discuss the concepts of paging, segmentation, virtual memory, and explain how demand paging
1. **Paging**: A memory management scheme that eliminates the need for contiguous allocation.
Memory is divided into fixed-size pages and frames, making it easier to allocate memory efficiently
and avoid fragmentation.
2. **Segmentation**: Divides memory into variable-sized segments based on the logical divisions of
a program. Each segment is addressed separately, improving modularity and protection.
3. **Virtual Memory**: A technique that uses disk space to extend the apparent memory capacity. It
allows processes to use more memory than physically available by swapping parts of processes in
and out of RAM.
4. **Demand Paging**: A method where pages are loaded into memory only when they are needed.
It reduces memory usage and load time. When a page not in memory is accessed, a page fault
occurs, and the required page is fetched from disk.
5. **Page Replacement Algorithms**: When memory is full and a new page needs to be loaded,
page replacement algorithms decide which page to remove:
- **FIFO (First-In-First-Out)**: Removes the oldest page.
- **LRU (Least Recently Used)**: Removes the least recently accessed page.
- **Optimal**: Replaces the page that will not be used for the longest time in future (theoretical).
These mechanisms together enhance system performance and memory management in
multitasking environments.