What happens if there is no free frame to allocate?
Here comes page replacement - find some page in memory that is “not that used” and swap it out. A free frame was just created.
Note that the same page may be brought into memory several times over the life of a process.
Use a dirty bit to reduce overhead of page transfers - only modified pages need to be written to disk, unmodified pages can be discarded.
Page replacement completes the separation between logical memory and physical memory. Large virtual memory can be provided on a smaller physical memory.