I'm doing an operating systems course at university and need to implement demand paging as a part of the major project. I've got the idea behind it, but just need to confirm some things.
Suppose physical memory is full, and a frame is chosen as victim to be written to disk, so that something else can be put in its place. When that frame is paged back in, and its old spot in the physical memory has been occupied by other things, does it mean I need to allocate another physical frame to put the old data and update the user's page table, so that from the user's point of view, the virtual memory stays the same but the physical memory has changed? Am I understanding the semantics of demand paging correctly? If not, how is it usually done?
Cheers