CS FundamentalsHardGATE CS (PYQ pattern)
The aging algorithm keeps an 8-bit counter per page (initially 0). At every clock tick each counter is shifted right by one bit and the page's reference bit for that tick is put into the leftmost bit. Reference bits over five ticks (tick 1 first) are page 0: 10110, page 1: 01101, page 2: 11010, page 3: 00111, page 4: 10011. After tick 5, which page has the smallest counter and is evicted?
- A. page 3
- B. page 1
- C. page 2
- D. page 4
Correct answer: C. page 2
After 5 ticks the counter holds tick 5 in bit 7, tick 4 in bit 6, ... tick 1 in bit 3. Counters: page 0 = 01101000, page 1 = 10110000, page 2 = 01011000, page 3 = 11100000, page 4 = 11001000. Page 2 is smallest. Reading the strings as binary with tick 1 most significant picks page 3 wrongly; counting references only cannot separate the pages.
More Operating Systems questions
- A single resource has 9 units and three processes have maximum claims 6, 5 and 4. Consider every possible current allocation (a0, a1, a2)…
- An ext3-style file system appends one data block to a file; the update also modifies the inode and the block bitmap. In ORDERED journaling…
- A RAID 0 array has 5 disks and a chunk size of 4 blocks (chunk k is on disk k mod 5, as the (k div 5)-th chunk on that disk). On which…
- An inode has 12 direct pointers, one single-, one double- and one triple-indirect pointer; blocks are 2048 bytes and pointers are 4 bytes…
- A parent creates a pipe, forks, and the child loops on read(fd[0], buf, 1) until it returns 0. The parent writes 3 bytes into fd[1] and…
- A system uses segmentation with paging (1024-byte pages). Segment table: seg 0: limit 3000, page frames [7, 2, 9]; seg 1: limit 1500…