The copy of the page in physical memory is different than the copy on disk. By using a dirty bit to indicate that the page has been modified, we can collect up a bunch of stores to that page and write them all back to disk at once when the page is swapped out of physical memory. This saves on the cost of having to write many individual pieces of data back to disk for every store that the program performs. Click here to see an example of virtual memory in action for our small 5 bit address space. Other benefits of virtual memory Virtual memory was initially introduced as a way for the hardware to provide a larger address space than was physically implemented in the system.
Virtual memory provides a means to protect the address space in various ways.
We don't want the program to modify any location that the operating system has reserved for itself. Said another way, portions of a process's virtual address space is protected from modification by the process itself. Another benefit of virtual memory is that it allows operating systems to more efficiently implement multi-tasking. Virtual memory allows these processes, each with it's own virtual address space, to effectively use the same physical memory.