piggyback
piggyback

Reputation: 9264

Do multi-level page table store the entire page-table if only half is used?

Imagine I have a 2-level page table with 1024 entries. Consider that only 3 2-level page tables are used, of which one is half empty, so I have a top-level page-table with three entries.

Now, how much memory does my page table system occupies in my RAM?

Do I have to store 4 pages of 1024 * 32bits = 4kBytes each, or I am allowed to store only what I use? (3 + 1024 * 2 + 1024 * (1/2)) * 32 bits only?

Upvotes: 0

Views: 264

Answers (1)

chqrlie
chqrlie

Reputation: 145307

You need a first level page with all entries populated to point to second level pages. The trick is to share second level pages that do not refer to any actual physical memory.

If you use only 2 pages of second level entries, you should need a total of 4 pages to map the entire memory space.

Upvotes: 1

Related Questions