get very confusing indeed! Virtual memory and paging also require special hardware
and operating system support.
The benefits of using virtual memory must outweigh these disadvantages to
make it useful in computer systems. But what are the advantages of virtual memory
and paging? It is quite simple: Programs are no longer restricted by the
amount of physical memory that is available. Virtual memory permits us to run
individual programs whose virtual address space is larger than physical memory.
(In effect, this allows one process to share physical memory with itself.) This
makes it much easier to write programs because the programmer no longer has to
worry about the physical address space limitations. Because each program
requires less physical memory, virtual memory also permits us to run more programs
at the same time. This allows us to share the machine among processes
whose total address space sizes exceed the physical memory size, resulting in an
increase in CPU utilization and system throughput.
The fixed size of frames and pages simplifies both allocation and placement
from the perspective of the operating system. Paging also allows the operating system
to specify protection (“this page belongs to User X and you can’t access it”)
and sharing (“this page belongs to User X but you can read it”) on a per page basis.