Question-1 Explain page table in brief. OR Explain Structure of Page Table.
- Page table is a data structure which translates virtual address into equivalent physical address.
- The virtual page number is used as an index into the Page table to find the entry for that virtual page and from the Page table physical page frame number is found.
- Thus the purpose of page table is to map virtual pages onto page frames.
- Typical fields of page table are Page frame number, Present / absent bit, Protection bits, Modified field, Referenced field, Cashing disabled field etc
Figure – A typical page table entry
- Different fields of typical page table are as below
- Page frame Number: This field shows the corresponding physical page frame number for a particular virtual page.
- Present/Absent bit: If this bit is 1, the entry is valid and can be used, if it is 0 the virtual page to which the entry belongs is not currently in memory. Accessing page table entry with this bit set to 0 causes a page fault.
- The Protection bits: This tells what kind of access is permitted. In the simplest form, this field contains 1 bit, with 0 for read/write and 1 for read only.
- Modified bit: When a page is written to, the hardware sets the modified bit. If the page in memory has been modified, it must be written back to disk. This bit is also called as dirty bit as it reflects the page’s state.
- Referenced bit: A references bit is set whenever a page is referenced, either for reading or writing. Its value helps operating system in page replacement algorithm.
- Cashing Disabled bit: This feature is important for pages that maps onto device registers rather than memory. With this bit cashing can be turned off.
Question-2 Explain Following Terms.
- In paging system, processes are started up with none of their pages in memory.
- When CPU tries to fetch the first instruction, it gets page fault, other page faults for global variables and stack usually follow quickly.
- After a while, the process has most of the pages it needs in main memory and it has few page faults.
- This strategy is called demand paging because pages are loaded only on demand, not in advance.
- The set of pages that a process is currently using is known as working set.
- A program causing page faults every few instructions is said to be thrashing.
- Many paging systems try to keep track of each process‘working set and make sure that it is in memory before letting the process run.
- Loading pages before allowing processes to run is called pre-paging.