Virtual memory uses the hard disk as additional memory by moving rarely used data between RAM and the paging file on disk. When RAM is full, unused data is written to the paging file to free up space in RAM. A page table maps virtual memory page numbers to physical locations in RAM or the paging file. This allows programs to access more memory than the available RAM by transparently storing data on disk when needed.