Os Assisnment 4
Os Assisnment 4
Note: Attempt all questions and give the logical answer in a precise manner.
Q1. Consider the following two-dimensional array D in the C programming language, which is
stored in row-major order:
int D[128][128];
Demand paging is used for allocating memory and each physical page frame holds 512
elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by
the operating system. A total of 30 physical page frames are allocated to a process that
executes the following code snippet:
}
}
What is the number of page faults generated during the execution of this code snippet?
Q2. Consider a paging system with the page table stored in memory.
a. If a memory reference takes 200 nanoseconds, how long does a paged memory reference take?
b. If we add TLBs, and 75 percent of all page-table references are found in the TLBs, what is the
effective memory reference time? (Assume that finding a page-table entry in the TLBs takes zero time
if the entry is there.)
Q3. Compare paging with segmentation with respect to the amount of memory required by the
address translation structures in order to convert virtual addresses to physical addresses.
Q4. Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (ill order), how would
the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB
(in order)? Which algorithm makes the most efficient use of memory?
Q5. Consider a logical address space of 64 pages of 1,024 words each, mapped onto a physical memory
of 32 frames.
Q6. Consider a computer system with a 32-bit logical address and 4-KB page size. The system supports
up to 512MB of physical memory. How many entries are there in each of the following?
Q7. Consider a logical address space of 32 pages with 1,024 words per page, mapped onto a physical
memory of 16 frames.
Q8. Explain the concept of paging. Also, explain paging hardware support using TLB with a suitable
diagram.
Q9. Explain the concept of demand paging. Consider the given references to the following pages by a
program: 0,9,0,1,8,1,8,7,8,7,1,2,8,2,7,8,2,3,8,3 How many pages faults will occur if the program has
three-page frames available to it and uses:
Q10. Explain the terms hit ratio and miss ratio. On a simple paged system, associative registers hold
the most active page entries and the full-page table is stored in main memory. If references satisfied
by associative registers take 100ns, and references through the main memory page table take 180 ns,
what must the hit ratio be to achieve an effective access time of 125 ns?