So every process has its own Page Table, the page table references the frame where the page is in physical memory and also has a valid-invalid bit that tells whether it is in physical memory or in secondary memory.

But how does the S.O. knows exactly where the page is saved when the valid-invalid bit it's off? Is there another table I'm missing? Or it just does a linear search through the whole SWAP space?


1 Answer 1


The first thing is that when the page-table entry is invalid you are allowed to use all the other bits in the page-table entry for whatever you want. So, for example, you could use it to store an offset into the swap space, or a disk block number.

But that's actually not the whole story. Each process on most operating systems has some kind of segment map that describes for each valid range of logical addresses what's in that range. Ranges that contain read-only data (such as the code segment, usually) don't need to be swapped. Instead they can just be reread from the executable that contains them if they are needed again.

  • $\begingroup$ I understand that but, let's say all the frames are filled with a Page from different Processes, a new Process comes in and tries to load his pages into Main Memory, since Main Memory is full, S.O. makes a SWAP. So now a Page that was in Main Memory is now in Secondary Memory. When the S.O. requests THAT same page again, how does he know the adress(Cylinder,Head,Sector) in the Secondary Memory? Is it mapped somewhere? Say 'PAGE 0X0019D | SECTORNUMBER' $\endgroup$ May 29, 2014 at 3:47
  • $\begingroup$ en.wikipedia.org/wiki/Logical_block_addressing $\endgroup$ May 29, 2014 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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