You are on page 1of 15

Virtual Memory

varprasad.

Virtual memory

Virtual memory is a concept used in some large


computer systems that permit the user to construct
programs as though a large memory space were
available, equal to the totality of auxiliary memory.
Each address is referenced by the CPU goes
through an address mapping from virtual address to
physical address in main memory
Provides a mechanism for translating programgenerated addresses into correct main memory
locations.

Address Space and Memory Space

An address used by a programmer will be called a


virtual address.
The set of such addresses the address space.
An address in main memory is called a location or
physical address.
The set of such locations is called the memory
space.

Address Space and Memory Space

The address space is the set of addresses


generated by programs as they reference
instructions and data
The memory space consists of the actual main
memory locations directly addressable for
processing.
The address space is allowed to be larger than the
memory space in computers with virtual memory.

Address Space and Memory Space

A computer with main


memory capacity of 32K
words.
15 bits are needed to
specify a physical address
in memory. Since 32K=215
Auxiliary memory for
storing 220=1024K words.

Thus Auxilary Memory has a capacity for


storing information equivalent to the capacity
of 32 main memories.

Relation between address and memory


space in a virtual memory system

Address Space and Memory Space

The CPU will reference


instructions and data with
a 20 bit address, but the
information at this address
must be taken from
physical memory because
access to auxiliary
storage for individual
words will be prohibitively
long.

Address Space and Memory Space

An additional memory unit


is required as well as one
extra memory access
time.
The table takes space
main memory and two
accesses to memory are
required with the program
running at half speed.
To use an associative
memory

Address Mapping Using Pages

Address space and Memory


space are each divided into
groups of fixed size.
The physical memory is
broken down into groups of
equal size called blocks
Range 64 4096 words
Page refers to groups of
address space of the same
size

Address space and memory space


split into groups of 1K words

Address Mapping Using Pages

If a page or block consists of 1K words,


Address space is divided into 1024 pages
Main memory is divided into 32 blocks
Although page and block are split into groups of 1K
words
Page refers to the organization of address space
Block refers to the organization of memory space
Programs considered to split into pages
Pageframe is used to denote the block

Address Mapping Using Pages

Address space of 8K
and a memory space of
4K.
If we split into groups of
1K words we obtain 8
and
Atpages
any given
time,4upblocks.
to 4pages of

Address space and memory space split


into groups of 1K words

address space may reside in main


memory in any one of the 4 blocks

2p

Address Mapping Using Pages

2P words per page. P


bits are used to specify
a line address and the
remaining high-order
bits of the virtual
address specify the
page number.

Address space and memory space split


into groups of 1K words

Virtual address has 13


bits

2p

Address Mapping Using Pages

Address space and memory space split


into groups of 1K words

Since each bit consists


of 210-1024 words.
The high order three
bits of a virtual address
will specify one of the 8
pages and the low order
10 bits give the line
address within the
Virtual address has 13
page.
bits

2p

The organization of the


memory mapping table

The memory page table


consists of 8 words
One for each page
The address in the page
table denotes the page
number and the content
of the word gives the
block number

The organization of the


memory mapping table

The table shows that


pages 1,2,5 and 6 are
now available in main
memory block 3,0,1,2

You might also like