Page replacement program in c
Thank You. Also, print the hit and page fault. Facebook Twitter Pinterest LinkedIn. This algorithm is used in a situation where an Operating system replaces an existing page with the help of memory by bringing a new page from the secondary memory. FIFO is the simplest among all algorithms which are responsible for maintaining all the pages in a queue for an operating system and also keeping track of all the pages in a queue.
The older pages are kept in the front and the newer ones are kept at the end of the queue. Pages that are in the front are removed first and the pages which are demanded are added. Now consider a page reference string 1, 3, 0, 3, 5, 6 with 3-page frames. So find the number of page faults? Let capacity be the number of pages that memory can hold. Let set be the current set of pages in memory. Else a Find the page in the set that was least recently used.
We find it using index array. We basically need to replace the page with minimum index. Return page faults. Below is implementation of above steps. Skip to content. Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Thanks for the program. It helps. Was wondering how can I find total number of dirty bits or pages from the code above? Your email address will not be published.
0コメント