星期五, 11月 06, 2009

CS3161 (A) OPERATING SYSTEM PRINCIPLES (DR. LIU WENYIN) (09CS3161_LW) - Answers to Tutorial 9 Questions

Q1 When does page fault occur ? Describe the action taken by the operating system when a page fault occurs.

A page fault occurs when an access to a page that has not been brought into main memory takes place (invalid page bit set in page table).
Page Fault Handling procedures,
(1)Scan the page table entry, the page is invalid – page fault occurs;
(2)O.S. generate TRAP interrupt;
(3)Locate the page with data in secondary storage;
(4)I/O requested to read the needed page into the available free frame;
(5)Upon completion of I/O, the process table and page table are updated as valid page and address in memory;
(6)The instruction is restarted.






Q2 (i) What is a page replacement ?(ii) What does the dirty bit mean ?


(i) Page replacement is the scheme (algorithm) to identify a victim page for replacement when all available frames (memory) are all currently used.
Page replacement operation involves selecting a frame (preferably not currently in use) as a victim for replacement; swap it out; swap in the desired page into the free frame; restart program.
Available page replacement scheme include FCFS, LFU, NRU.
(ii) A bit stored in the page table, if set, the page has been modified (dirty page), and must be written back to backing store before being use as a victim for page replacement to create a free frame in physical memory.
It is desirable try not to replace a dirty page, since it will take longer (with the write-back operation).




Q3 (i) What is Thrashing ?(ii) How does the system detect thrashing ?(iii) What can the system do to eliminate it ?


(i) Thrashing in a virtual memory system is a high page fault activities situation, where the system spends most of the time in page swapping than executing processes.
Thrashing is caused by under-allocation of the minimum number of pages required by a process, forcing it to continuously page fault.
(ii) The system can detect thrashing by elevating the level of CPU utilisation as compared to the level of multiprogramming.
The sudden drop in CPU utilisation while increasing the level of multiprogramming (increasing the number of processes) identifies the thrashing point.
(iii) Thrashing can be eliminated by reducing the level of multiprogramming, (that is to decrease the number of processes in the system).

沒有留言:

推薦此文

這個小工具發生錯誤