Consider a system that uses pure demand paging.

(a) When a process first starts execution, how would you characterize the page fault rate?

(b) Once the working set for a process is loaded into memory, how would you characterize
the page fault rate?

(c) Assume that a process changes its locality and the size of the new working set is too
large to be stored in available free memory. Identify some options system designers could
choose from to handle this situation.

(a) When a process first starts execution in a system that uses pure demand paging, the page fault rate is typically high. This is because initially, the process has not yet loaded any pages into memory, so any memory reference it makes will result in a page fault. As a result, the system needs to bring in the required pages from disk and allocate memory for them.

(b) Once the working set for a process is loaded into memory, the page fault rate decreases significantly. This is because the working set represents the pages that the process frequently accesses, and they are already in memory. As long as the process stays within its working set, the page fault rate remains low.

(c) If a process changes its locality and the size of the new working set is too large to be stored in the available free memory, system designers have several options to handle this situation:

1. Increase the amount of physical memory: One option is to add more physical memory to the system, allowing it to accommodate larger working sets. This can help reduce the page fault rate and increase overall performance.

2. Implement a page replacement algorithm: In cases where the working set exceeds the available memory, a page replacement algorithm can be used to prioritize which pages to keep in memory and which to evict. Algorithms like Least Recently Used (LRU) or Optimal can be implemented to ensure that the most frequently used pages remain in memory.

3. Use a secondary storage device: If adding more physical memory is not feasible, the system can use a secondary storage device, such as a solid-state drive or a hard disk, to store pages that do not fit in the main memory. This approach, known as swapping or virtual memory, allows the system to manage larger working sets by storing less frequently used pages on secondary storage.

4. Employ compression techniques: Another option is to use compression techniques to reduce the memory footprint of pages. By compressing the pages before storing them in memory, more pages can fit within the available memory, potentially accommodating larger working sets.

It is worth noting that the choice of implementation depends on the specific requirements and constraints of the system, such as available resources, performance goals, and the nature of the workload.

Show