Question
In the Least Recently Used (LRU) page replacement
algorithm, given the following reference string 4, 2, 4, 1, 5, 2, 3, 4, and assuming 3 frames, how many page faults will occur?Solution
LRU page replacement works by replacing the page that has not been used for the longest time. For the reference string 4, 2, 4, 1, 5, 2, 3, 4 with 3 frames, the page faults occur as follows: • Insert 4 (fault), Insert 2 (fault), Access 4 (hit), Insert 1 (fault), Insert 5 (fault, replace 4), Access 2 (hit), Insert 3 (fault, replace 1), Access 4 (fault, replace 5). Thus, there are 6 page faults in total. LRU minimizes page faults compared to other algorithms by always keeping the most recently used pages in memory. Why other options are wrong: A) 3 faults would require the reference string to contain repeated pages with no replacements. B) 5 faults underestimate the replacements required after the first few frames fill up. D) 7 faults occur in algorithms with more aggressive replacements like FIFO. E) 8 faults assume no page hits at all, which is incorrect since some pages are reused before replacement.
In a 5-stage pipeline (Fetch, Decode, Execute, Memory, Write-back), how many instructions can be in various stages of processing at the same time?
A transformer has a primary coil with 300 turns and a secondary coil with 150 turns. If the primary voltage is 240V, calculate the secondary voltage.
Which of the following is a common problem that synchronization mechanisms address in multi-threaded or multi-process environments?
What happens when a program accesses data that is not currently in physical memory (RAM) due to virtual memory management?
Which of the following is not a valid keyword in C++ language?
XML is designed to ____ and ____ data)
What is the main purpose of a digital signature in public key cryptography?
The best case time complexity of selection sort?
What is the space complexity of an algorithm?
Which functions are declared inside a class have to be defined separately outside the class?