0
$\begingroup$

I was reading a textbook which says that: enter image description here

If the valid bit is set, the address field indicates the start of the corresponding physical page in DRAM where the virtual page is cached. If the valid bit is not set, then a null address indicates that the virtual page has not yet been allocated. Otherwise, the address points to the start of the virtual page on disk.

My question is, does each page tabe entry(PTE) need to be match the same offset one in disk? for example, PTE 1 has VP 1 in physical memory, but can PTE 1 originally mapped to VP 3? or PTE 1 has to map VP 1, PTE 2 has to map VP 2, PTE 3 has to map VP 3 and so on?

if PTE x has to map VP x, then why when valid bit is not set then the address points to the start of the virtual page on disk? can't we use the offset x in PTE x to infer that it maps to VP x?

$\endgroup$
1
$\begingroup$

My question is, does each page tabe entry(PTE) need to be match the same offset one in disk?

No. They can map to anywhere in physical memory and they can map to anywhere on the disk. If they had to map to the same offset, there would be no point using virtual memory.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.