Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

virtual memory system diagram Consider a virtual memory system with the followin

ID: 3558331 • Letter: V

Question

virtual memory system diagram

Consider a virtual memory system with the following parameters:
32-bit virtual address
4-kbyte virtual page size
32-bit Page Table Entry (PTE)
2-Gbyte physical memory
(a) Draw a diagram of the 32-bit address showing the length and placement of all bit fields i.e. the offset in the page(O), and the page number (P).

(b) How many virtual pages are available in this system?

(c) How many physical frames are available in this system?

(d) What is the size, in bytes, of the page table?

Explanation / Answer

(a) draw a diagram of the 32-bit address showing the length and placement of all bit fields i.e. the offset in the page(O), and the page number(P).


32-bit virtual address

page number | offset

PPPPPPPPPPPPPPPPPPPP|OOOOOOOOOOOO

(b) how many virtual pages are available in this system?

2^20 = 1 048 576 virtual pages

You have 32 bits available for the PTE. The virtual page number is the index into the table, which is irrespective of the 32 bits for each PTE. That means you have 32 bits for status bits (e.g. valid, dirty, protection, etc).

If you are dealing with only pages in RAM (i.e. nothing swapped to disk), then the answer is easy. You simply divide the physical memory size by page size:
2GB / 4KB = 2^31 / 2^12 = 2^19 = 524 288 frames
That means you need 19 bits of the PTE for physical page size, leaving 32 - 19 = 13 bits for status, etc. That's more than enough

If you have to consider swapping to disk, then it's a bit trickier. Since disk is typically much, much larger than RAM, you could probably easily fill all 32 bits of the PTE with physical (RAM or disk) frame addresses. So then the question is: how many bits of the PTE are used for status info? Remove those from the total, and that is how many bits you have left to address physical pages (frames). So Let's say you have 5 status bits total: valid, dirty and 3 for protection (read, write, execute). That gives
32 - 5 = 27 bits; 2^27 = 134 217 728 frames

d) name TWO fields of the page table entry.

- page frame number
- valid bit(set if page is in memory)
- other flags: modified(dirty), referenced, protection bits