OS Presentation 2023
OS Presentation 2023
OS Presentation 2023
• Virtual memory expands the effective memory capacity of a computer system beyond its
physical limits.
• It facilitates memory sharing, swapping, and paging, optimizing memory usage and improving
overall system performance. It enables multitasking and efficient memory allocation for
running multiple programs simultaneously.
Why Do We Need Virtual Memory ?
• Increased Addressable Memory:
1. Virtual memory allows a computer system to access more memory than what is physically
available.
2. This allows programs to utilize more memory than the available physical RAM, enabling them to
run larger and more complex tasks.
1. Virtual memory facilitates memory isolation between different processes running on a computer.
2. This isolation prevents one process from accessing or modifying another process's memory,
enhancing security and stability.
• Efficient Memory Management:
1. Virtual memory enables efficient memory management by utilizing techniques like demand paging
and page swapping.
2. Demand paging loads only the necessary portions of a program into physical memory, allowing
for efficient memory usage.
3. Page swapping moves infrequently used pages of memory between RAM and disk storage, freeing
up physical memory for other tasks.
1. Virtual memory simplifies program development by providing a uniform and consistent memory
model for applications.
2. Programmers can develop applications using a flat, contiguous address space, independent of
physical memory limitations.
What is Demand Paging in
Virtual Memory ?
• Demand paging is a virtual memory management technique where pages are loaded into
memory only when they are explicitly requested by processes.
• Instead of loading the entire program into memory at once, only the required pages are
brought into memory as needed.
• When a process references a page that is not in physical memory, a page fault occurs, and
the operating system brings the required page from disk into memory.
• Demand paging allows for efficient memory utilization by loading pages on-demand,
reducing the initial memory footprint of processes.
Benefits of demand Paging in
Virtual Memory
1. Reduced Memory Footprint:
Demand paging reduces the amount of physical memory required to run processes
by loading only necessary pages.
• Performance Improvement:
Copying memory can be a costly operation, particularly when dealing with large memory pages. By
postponing the copy until modifications occur, COW minimizes the overhead associated with copying.
Definition:
Page replacement is a crucial aspect of virtual memory management, where the operating system dynamically
moves pages between physical memory and secondary storage (such as a hard disk or SSD) to efficiently
utilize limited physical memory resources. When the physical memory becomes full and a new page needs to
be brought in, the operating system selects a victim page to be replaced with the new page. This process is
known as page replacement.
Page Replacement Algorithm
When a page fault occurs the operating system needs to select a page to replace from physical
memory to make room for the required page. This selection is done using a page replacement
algorithm.
1. FIFO (First-In-First-Out):
The page that has been in memory the longest is selected for replacement.
2. LRU (Least Recently Used):
This algorithm replaces the page that has not been used for the longest time.
3. LFU (Least Frequently Used):
This Algorithm replaces the page that has been accessed the fewest number of times
4. Optimal:
It replaces the page that will not be used for the longest time in furture.
ALLOCATION
Definition:
OF FRAMES The allocation of frames in virtual memory refers to the
assignment of physical memory (RAM) frames to the
MEMORY
Memory Allocation Policies and Consideration.
1. Contiguous Allocation:
2. Non-Contiguous Allocation
3. Segmentation