Consider a computer system with demand paging.
a) Briefly explain the term "page fault".
b) Briefly explain the term "page replacement policy"
c) Briefly explain how the LRU policy works.
d) In demand paged memory management that uses LRU, a process makes the following sequence of page references:
1 3 4 2 1 1 2 3 4 3 5 1 4 6 1 4 3
Calculate the number of page faults, assuming that only 3 page frames are available to the process. Assume that no pages are initially loaded. Show your work.
Suppose there are N worker processes (0..N-1), each with a critical section where work is done. There is also a special process which executes the following code:
int p = -1; // GLOBAL variable shared by all processes, initialized once
int lock = 0; // GLOBAL variable shared by all processes, initialized once
while (1) {
while (lock == 1) {} // empty loop body
p = (p+1) % N;
}
Each worker process has its own process ID mypid, and executes the following code:
while (1) {
while (p != mypid) {} // empty loop body
lock = 1;
// CRITICAL SECTION WHERE THE PROCESS DOES WORK
lock = 0;
}
Answer YES/NO to the follow questions and provide a brief description.
a) Does the solution guarantee mutual exclusion?
b) Does the solution guarantee that work will be done?
c) Does the solution guarantee fairness?