Virtual memory allows a computer to use more memory than is physically installed by storing data that does not fit in real memory on disk. It works by dividing memory into pages that are swapped between disk and RAM as needed. When programs access virtual addresses, a memory management unit translates them to physical addresses. This allows programs to run without being aware of their physical memory limitations. Virtual memory improves efficiency by allowing multiple programs to share limited RAM and enlarges the effective address space available to each program.