Consider a system with three frames in memory and following memory references in the working set

2 1 2 3 5 4 1 3 4 2 1

How many page fault will be there if we use second chance page replacement algorithm ?

This question was previously asked in
NIELIT Scientific Assistant CS 5 Dec 2021 Official Paper
View all NIELIT Scientific Assistant Papers >
  1. 7
  2. 8
  3. 9
  4. 10

Answer (Detailed Solution Below)

Option 1 : 7
Free
NIELIT Scientific Assistant Quantitative Aptitude Mock Test
20 Qs. 20 Marks 30 Mins

Detailed Solution

Download Solution PDF

The correct answer is Option 1: 7.

Key Points

  • The Second Chance Page Replacement Algorithm is a modification of the FIFO (First In First Out) algorithm that reduces the number of page faults by giving pages a second chance to stay in memory if they have been referenced recently.
  • When a page needs to be replaced, the algorithm inspects the reference bit of the pages in the order they were loaded into memory (FIFO order).
  • If a page's reference bit is 0, it is replaced. If the reference bit is 1, the bit is cleared and the page is given a second chance, moving to the back of the queue.
  • Consider the memory references in the working set: 2, 1, 2, 3, 5, 4, 1, 3, 4, 2, 1 with three frames in memory.
  • The detailed steps are as follows:
    • Initially, all frames are empty.
    • Reference 2: Page 2 is loaded into the frame. (Page Fault)
    • Reference 1: Page 1 is loaded into the frame. (Page Fault)
    • Reference 2: Page 2 is already in the frame. (No Page Fault)
    • Reference 3: Page 3 is loaded into the frame. (Page Fault)
    • Reference 5: Page 2 is given a second chance (reference bit cleared), Page 1 is given a second chance (reference bit cleared), Page 3 is replaced by Page 5. (Page Fault)
    • Reference 4: Page 2 is given a second chance, Page 1 is given a second chance, Page 5 is replaced by Page 4. (Page Fault)
    • Reference 1: Page 1 is already in the frame. (No Page Fault)
    • Reference 3: Page 2 is given a second chance, Page 1 is given a second chance, Page 4 is replaced by Page 3. (Page Fault)
    • Reference 4: Page 2 is given a second chance, Page 1 is given a second chance, Page 3 is given a second chance (reference bit cleared), Page 4 is loaded into the frame. (Page Fault)
    • Reference 2: Page 2 is replaced by Page 2. (Page Fault)
    • Reference 1: Page 1 is already in the frame. (No Page Fault)
  • In total, there are 7 page faults.

Additional Information

  • The Second Chance Algorithm is also known as the Clock Algorithm because it can be visualized as a circular queue with a clock hand pointing to the next page to be considered for replacement.
  • This algorithm helps reduce page faults by considering whether a page has been used recently before deciding to replace it.

Latest NIELIT Scientific Assistant Updates

Last updated on Jun 12, 2025

-> NIELIT Scientific Assistant city intimation slip 2025 has been released at the official website.

-> NIELIT Scientific Assistant exam 2025 is scheduled to be conducted on June 28. 

-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.

-> Online application form, last date has been extended up to from 17th April 2025.

->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.

 

-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).

More Page Replacement Policy Questions

More Virtual Memory Questions

Hot Links: teen patti master app teen patti party teen patti fun