Reputation: 1949
I understand that for every process virtual addresses are mapped to physical pages.The corresponding physical page number for a given virtual page number would be available in page table entry.
But i am curious to know how this mapping is done by kernel. How does kernel knows which physical page is free before allocating that page to a virtual page number. Does it keeps track of all the available empty pages in physical memory?
Upvotes: 1
Views: 380
Reputation: 239041
Yes, the kernel keeps a data structure describing the current status of all the physical pages that are available - an array of struct page
entries, one for each physical page.
Upvotes: 1