OS Menu9>
- OS Home
- Introduction
- CPU Scheduling
- What is Process?
- Process Lifecyle
- Process Control Block
- Process Scheduling
- Context Switching
- CPU Scheduling
- FCFS Scheduling
- SJF (non-preemptive)
- SJF (Preemptive - SRTF)
- Round Robin
- Priority Scheduling
- Convoy Effect
- Scheduler Vs Dispatcher
- Preemptive Vs non
- Preemptive scheduling
- Non preemptive scheduling
- Process Synchronization
- Deadlock
- Popular Algorithms
- Memory Management
- Memory Management Introduction
- Partition Allocation Method
- First Fit
- First Fit (Intro)
- First Fit in C
- First Fit in C++
- First Fit in Python
- First Fit in Java
- Best Fit
- Best Fit (Intro)
- Best Fit in C
- Best Fit in C++
- Best Fit in Java
- Worst Fit
- Worst Fit (Intro)
- Worst Fit in C++
- Worst Fit in C
- Worst Fit in Java
- Worst Fit in Python
- Next Fit
- First fit best fit worst fit (Example)
- Memory Management 2
- Memory Management 3
- Page Replacement Algorithms
- LRU (Intro)
- LRU in C++
- LRU in Java
- LRU in Python
- FIFO
- Optimal Page Replacement algorithm
- Optimal Page Replacement (Intro)
- Optimal Page Replacement Algo in C
- Optimal Page Replacement Algo in C++
- Optimal Page Replacement Algo in Java
- Optimal Page Replacement Algo in Python
- Thrashing
- Belady’s Anomaly
- Static vs Dynamic Loading
- Static vs Dynamic Linking
- Swapping
- Translational Look Aside Buffer
- Process Address Space
- Difference between Segmentation and Paging
- File System
- Off-campus Drive Updates
- Get Hiring Updates
- Contact us
PREPINSTA PRIME
Optimal Page Replacement in OS
Optimal Page Replacement in OS
The process in an operating system occupies some dedicated memory. This memory is further divided into chunks called pages. These pages are brought from secondary memory to the primary memory as the CPU demands them. This method is known as page swapping and is done through an algorithm.
To fulfill the demand of the most frequently used pages, the operating systems keep these pages in the primary memory. Pages that not have been used since a long time are replaced with the most frequently used pages under the method called as Optimal Page Replacement technique.
The approach can be best explained by the below reference string and the frame size.
- Read Also – Optimal page replacement in python
- Read Also – Optimal Page LRU in C++
- Read Also – Optimal page LRU in C
The diagrammatic representation above states the order in which the stack will be filled as per the demands in the primary memory. In the case of a page fault, the least recently used page is replaced with the pager which in immediate demand.
Algorithm for Optimal Page Replacement
Step 1: Push the first page in the stack as per the memory demand.
Step 2: Push the second page as per the memory demand.
Step 3: Push the third page until the memory is full.
Step 4: As the queue is full, the page which is least recently used is popped.
Step 5: repeat step 4 until the page demand continues and until the processing is over.
Step 6: Terminate the program.
Read More
- Memory Management Introduction
- Partition Allocation Method
- Buddy- System Allocator
- Paging
- Types of Paging
- Fragmentation
- Mapping Virtual address to Physical Address.
- Virtual Memory
- Demand Paging
- Implementation of Demand paging and page fault
- Segmentation
- Page Replacement Algorithms
- Thrashing
- Belady’s Anomaly
- Static vs Dynamic Loading
- Static vs Dynamic Linking
- Swapping
- Translational Look Aside Buffer
- Process Address Space
- Difference between Segmentation and Paging
Login/Signup to comment