Paging Concept of Virtual Memory 2
Paging Concept of Virtual Memory 2
VIRTUAL MEMORY
BATCH 3
DHANUSH S – 23I213
DHEVASRIE P P – 23I214
DHIVYESS YADAV N– 23I215
DHYANESH P – 23I216
DUSHAL VIGNESH – 23I217
GIRETHAREN M– 23I218
INTRODUCTION
What is Virtual Memory?
• Memory management technique extending physical
RAM using disk storage.
• Enables large programs to run on limited physical
memory.
• Provides each program with its own large, continuous
address space.
• Uses disk storage (swap space) for data not currently
in RAM.
How Virtual Memory Works
• Programs access data using virtual addresses.
• Data not in RAM is swapped from disk to RAM when
needed.
• Managed by the Operating System.
3
BALANCE 1 GB
What is Paging?
• Virtual memory is divided into fixed-size blocks called pages.
• Physical memory (RAM) is divided into page frames of the
same size.
• Pages are mapped to frames using a Page Table.
• Optimizes memory use.
• Entries get reduced by 1000 times.
1 WORD = 4 BYTES
-select for replacement a frame from a process with lower priority number
LOBAL VS LOCAL ALLOCATION
Global replacement - process selects a replacement frame from the set of all frames; one
process can take a frame from another
- But then process execution time can vary greatly
-But greater throughput so more common
Local replacement - each process selects from only its own set of allocated frames
-More consistent per-process performance
- But possibly underutilized memory
DVANTAGES & DISADVANTAGES
Advantages:
-Reduces external fragmentation.
Disadvantages:
-Internal fragmentation within frames.
5.
6.
If no page frame is free, the virtual memory manager performs a page replacement
operation to replace one of the pages existing in memory with the page whose
reference caused the page fault.
2 2 2 2 2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 0 0 0 0
0 0 0 0 0 0 4 4 4 4 4 4 4
7 7 7 7 7 3 3 3 3 3 3 3 3 3
M M M M H M H M H H M H H H
• In this algorithm,pages are replaced which are not used for the longest duration of time in the
future.
• This algorithms replaces the page which will not be referred for so long in future.
• This algorithm cannot be implemented in a general purpose operating system because it is
impossible to compute reliably how long it will be before a page is going to be used.
Example: Consider the page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3 with 4 page frame.
Find number of page fault using Optimal Page Replacement Algorithm
Points to Remember
Page Not Found - - - > Page Fault
Page Found - - - > Page Hit
1. What is LRU?
• Replaces the Least Recently Used page when a new page is
needed.
• Tracks page usage: the page that hasn't been used for the longest
time is replaced
1. Advantages:
• It performs well when recently used pages are likely to be
used again.
• LRU works well in most cases, close to the optimal page
replacement strategy.
2. Disadvantages:
• Requires extra space to track access history.
• Can be more complex to implement compared to simpler
algorithms like FIFO (First In First Out).
THANK YOU