Copyright © 1998-2001 by Eskicioglu & Marsland
Virtual Memory
Jan’01Virtual Memory
Copyright © 1998-2001 by Eskicioglu & Marsland
Virtual Memory
1
Jan’01Introduction
So far, we separated the programmer’s view of memory
from that of the operating system using a mapping
mechanism. This allows the OS to move user programs
around and simplifies sharing of memory between them.
However, we also assumed that a user program had to be
loaded completely into the memory before it could run.
Problem: Waste of memory, because a program only needs
a small amount of memory at any given time.
Solution: Virtual memory; a program can run with only some
of its virtual address space in main memory.
Copyright © 1998-2001 by Eskicioglu & Marsland
Virtual Memory
2
Jan’01Principles of operation
The basic idea with virtual memory is to create an illusion
of memory that is as large as a disk (in gigabytes) and as
fast as memory (in nanoseconds).
The key principle is locality of reference, which recognizes
that a significant percentage of memory accesses in a
running program are made to a subset of its pages. Or
simply put, a running program only needs access to a
portion of its virtual address space at a given time.
With virtual memory, a logical (virtual) address translates
to:
– Main memory (small but fast), or
– Paging device (large but slow), or
– None (not allocated, not used, free.)
Copyright © 1998-2001 by Eskicioglu & Marsland
Virtual Memory
3
Jan’01A virtual view
Virtual Address Space
(logical)
Main Memory (physical)
Paging Device
Backing Storage
Free
Copyright © 1998-2001 by Eskicioglu & Marsland
Virtual Memory
4
Jan’01Virtual memory
Virtual memory (sub-)system can be implemented as
an extension of paged or segmented memory
management or sometimes as a combination of both.
In this scheme, the operating system has the ability
to execute a program which is only partially loaded in
memory.
Note: the idea was originally explored earlier in
“overlays”. However now, with virtual memory, the
fragmentation and its management i