Paging allows the machine to provide a layer of indirection between the virtual memory address space and the real one. After being given an address, the MMU goes through the page tables and determines if the corresponding frame is in memory. If it is, then it has found the real address and the relevant instruction can be performed.
What if it's not in RAM, however? What happens when the MMU visits the page table and sees that a corresponding frame needs to be fetched from the disk? How does it know where it is in the disk? How is virtual address we started with used to map something specific in the disk?
I suspect this isn't done through software because it'd be too expensive to have some sort of page table for the disk that maps all of that address space since it'd automatically double the number of I/O operations and use a considerable amount of memory, but is there another way?
Thanks!
Edit: the MMU doesn't deal with the disk other than when telling the OS to fetch a given page. The page fault handler within the OS is what fetches the content from the disk, but how?
The MMU isn't responsible for anything other than translating a virtual address to a physical address. It doesn't do disk accesses or anything.
The trick used by many operating systems to swap memory to disk or map a file on disk to a virtual memory address space generally works by