Question

A machine has a 32-bit address space and a page size of 8KB. The page table is entirely in hardware, with one 32-bit word per entry. When a process is scheduled, its page table is copied to the hardware from memory, at a rate of one word / 100 ns. If each process runs for 100ms (including the time to load the page table), what fraction of the CPU time is devoted to loading the page tables?

Yes; this is a Homework problem. I looked into it and so far I've found that

size of pagetable(bytes) = number of entries *size of entry. Therefore x= 32*8192(bits) = 262144

I know this is the wrong answer and that it's 52; 4288ms which i will be using in the latter equation of

Time to load page table / Total time = CPU use

a solution which I can't quite understand is posted here.

http://www.cs.inf.ethz.ch/ssw/exercises/solution_04.pdf

Was it helpful?

Solution

The tricky part here is calculating the size of the page table. Once you have that, multiply it times the time it takes to load each table entry. It's not relevant how big a table entry is - only how long it takes to load it.

So think about a 32 bit address space. How many 8K chunks are there in it? That's the part of the document you referenced that is subracting bits. It takes 13 bits to describe 8K. Notice that 2 ^ 13 = 8K (Quickly calculate it by noting that 1024 takes 10 bits. It's sort of mnemonic and easy to remember. 8 takes 3 bits and 10 + 3 = 13. Or use a calculator to see what power of 2 equals 8K.)

32 bits for the whole address space less 13 gives 19, so there are 2 ^ 19 pages.

Now just multiply 2 ^ 19 times 100 ns and bingo. You have it.

OTHER TIPS

“32-bit address space and an 8-KB page” means that there is 13 bits(8-KB) for page offset and the rest of 19 bits is for indexing page table entry.

ref image

If the above image is not working, then you can see here:

https://www.slideshare.net/kumar_vic/computer-memory-management/14?src=clipshare

<----------------------32 bits(word)---------------------->
<-----19 bits(index)----- ><-----13 bits(page offset)----->

Therefore, there are 2^19 entries in page table.

Each entry needs 100 ns to be copied from disk to memory.

Total time for copy one page table needs 2^19 * 100 ns = 52.42 ms.

The total time spending on one process is 100 ms, so the fraction of the CPU time which devoted to loading the page table is (52.42)/(100) = 52.42 %

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top