Step 1: LRU (Least Recently Used) Page Replacement.
In LRU, the page that has not been used for the longest time is replaced.
Step 2: Process the page reference string.
We process the reference string one page at a time, replacing the least recently used page when necessary. The sequence of frames is updated after each reference.
- Reference 7 → Page fault, frames: [7]
- Reference 0 → Page fault, frames: [7, 0]
- Reference 1 → Page fault, frames: [7, 0, 1]
- Reference 2 → Page fault, replace 7 (LRU), frames: [0, 1, 2]
- Reference 0 → No page fault, frames: [0, 1, 2]
- Reference 3 → Page fault, replace 1 (LRU), frames: [0, 2, 3]
- Reference 0 → No page fault, frames: [0, 2, 3]
- Reference 4 → Page fault, replace 2 (LRU), frames: [0, 3, 4]
- Reference 2 → Page fault, replace 3 (LRU), frames: [0, 4, 2]
- Reference 3 → Page fault, replace 0 (LRU), frames: [3, 4, 2]
- Reference 0 → Page fault, replace 4 (LRU), frames: [3, 0, 2]
- Reference 3 → No page fault, frames: [3, 0, 2]
- Reference 2 → No page fault, frames: [3, 0, 2]
Step 3: Count the total number of page faults.
Total page faults = 9.
Consider a demand paging system with three frames, and the following page reference string: \[ 1\ 2\ 3\ 4\ 5\ 4\ 1\ 6\ 4\ 5\ 1\ 3\ 2. \] The contents of the frames are as follows initially and after each reference (from left to right):
The *-marked references cause page replacements. Which one or more of the following could be the page replacement policy/policies in use?
In C language, mat[i][j] is equivalent to: (where mat[i][j] is a two-dimensional array)
Suppose a minimum spanning tree is to be generated for a graph whose edge weights are given below. Identify the graph which represents a valid minimum spanning tree?
\[\begin{array}{|c|c|}\hline \text{Edges through Vertex points} & \text{Weight of the corresponding Edge} \\ \hline (1,2) & 11 \\ \hline (3,6) & 14 \\ \hline (4,6) & 21 \\ \hline (2,6) & 24 \\ \hline (1,4) & 31 \\ \hline (3,5) & 36 \\ \hline \end{array}\]
Choose the correct answer from the options given below:
Match LIST-I with LIST-II
Choose the correct answer from the options given below:
Consider the following set of processes, assumed to have arrived at time 0 in the order P1, P2, P3, P4, and P5, with the given length of the CPU burst (in milliseconds) and their priority:
\[\begin{array}{|c|c|c|}\hline \text{Process} & \text{Burst Time (ms)} & \text{Priority} \\ \hline \text{P1} & 10 & 3 \\ \hline \text{P2} & 1 & 1 \\ \hline \text{P3} & 4 & 4 \\ \hline \text{P4} & 1 & 2 \\ \hline \text{P5} & 5 & 5 \\ \hline \end{array}\]
Using priority scheduling (where priority 1 denotes the highest priority and priority 5 denotes the lowest priority), find the average waiting time.