Question
Page Replacement Algorithm Program Code In Python Using The Skeleton Code Provided Below. ''' Simple FIFO Page Replacement Algorithm ''' Def FIFO(Size, Pages): F =
Page Replacement Algorithm Program Code In Python Using The Skeleton Code Provided Below. ''' Simple FIFO Page Replacement Algorithm ''' Def FIFO(Size, Pages): F = -1 Faults = 0 # Just A Value Used In Skeletal Code To Make It Execute Page = [] For I In Range(Pages): Page.Append(-1) Return Faults ''' LRU Algorithm ''' Def
Page replacement algorithm Program code in python using the skeleton code provided below.
''' Simple FIFO page replacement algorithm ''' def FIFO(size, pages): f = -1 faults = 0 # just a value used in skeletal code to make it execute page = [] for i in range(pages): page.append(-1) return faults
''' LRU algorithm ''' def LRU(size, pages): faults = 0 # just a value used in skeletal code to make it execute return faults
def main(): pages = (7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1)
size = int(input('Enter number of frames: '))
print('The FIFO algorithm had', FIFO(size,pages), 'page faults.')
print('The LRU algorithm had', LRU(size,pages), 'page faults.')
main()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started