120 likes | 258 Views
Page Replacement Algorithms and Simulation. Neville Allen. Introduction. Page replacement algorithms decide which page to swap out from memory to allocate a new page to memory. Page fault happens when a page is not in memory and needs to be placed into memory
E N D
Page Replacement Algorithms and Simulation Neville Allen
Introduction • Page replacement algorithms decide which page to swap out from memory to allocate a new page to memory. • Page fault happens when a page is not in memory and needs to be placed into memory • The idea is to find an algorithm that reduces the number of page faults which limits the time it takes to swap in and swap out a page
First In First OutFIFO • Simple queue structure, the page at the head of the queue gets swapped out when a new page needs to be allocated • The new page gets added to the end of the queue
Least Recently UsedLRU • Min_array that kept track of count value • When page needs to be swapped out look through min_array to find the min value and swap the value from reference array to frame array
Most Recently UsedMRU • Max array keeps track of values of count value • When page needs to be swapped out find the max value in max array and swap the value from reference array to frame array
Second Chance • Bit array that keeps track of one or zero for the particular value from the reference array • When a page needs to be swapped out searches through bit array to find a zero, when it finds a zero it puts the value in reference array to the frame array. If a one is entered it changes the value in bit array to zero and keeps looking for another zero
Optimal • This is in theory the best algorithm to use for page replacement. • This algorithm looks ahead to see the likely hood that a value in the frame array is going to come up soon. If the value in value array doesn’t come up soon it will be swapped out when a new page needs allocated
Results • I found that MRU and FIFO were some of the best algorithms • Keeping the frame the same when I doubled the range of numbers from 5 to 10 the page faults less then doubled • Increasing the range from 5 to 15, doubles the amount of page faults