Anda di halaman 1dari 14

Virtual memory

Introduction

Virtual memory
Solves problem of limited memory space
Creates the illusion that more memory exists
than is available in system
Two types of addresses in virtual memory
systems
Virtual addresses
Addresses used by programmer
set of such addresses ADDRESS SPACE
Location (or) Physical addresses
Describes locations in main memory
set of such addresses MEMORY SPACE
Memory management unit (MMU)
Translates virtual addresses to physical

Introduction
It 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.
Virtual memory system provides a mechanism
for translating program generated addresses into
correct main memory locations. (using Mapping
table)
Address space is allowed to be larger than the
memory space in computers with virtual memory

Paging
The relation between
virtual addresses
and physical memory addresses
given by page table

Page Tables

Internal operation of MMU with 16 4 KB pages


5

Virtual Memory: Basic Concepts


Virtual address space, V
Range of virtual addresses that a process may
reference

Real address space, R


Range of physical addresses available on a
particular computer system

In a multiprogram computer system,


programs and data are transferred to and
fro from auxiliary memory and main
memory

Suppose that program 1 is currently being


executed in the CPU
Program 1 and a portion of its associated
data are moved from auxiliary to main
memory
Portions of programs and data need not be
in adjacent locations in memory since
information is being moved in and out
Empty spaces may be available in
scattered locations

Memory table for mapping a


Virtual AddressTo map 20 bit virtual
address to 15 bit
physical address

The mapping is dynamic operation, which means that


every address is translated immediately as a word is
referenced by CPU.

The mapping table may be stored in a separate


memory or in main memory
In the first case, an additional memory unit is
required as well as one extra memory access
time
In the second case, the table takes space from
main memory and two accesses to memory are
required with the program running at half
speed.
Third alternative is to use an associative
memory

Address Mapping Using Pages


Page : groups of address space of the same size
Blocks : physical memory broken down into groups
of same size

Address mapping is simplified if the information in the


address space and the memory space are each divided

To facilitate the mapping the virtual address is considered


to be represented by two numbers:
1) Page no. address
2) Line within the page
Ex :
Virtual address 13 bits
Each page 1K(ie) 210 = 1024 words
3 MSB one of the Page no. and Remaining 10 bits line
address with in the page
)
)

line no. in address space and memory space is the same


only mapping required is from a page no. to a block no.

Memory Mapping Table in a Paged


System

Memory table consist of _________ words.


_________ for each page
Address in the page table denotes page no.
Content of the word gives the block no. where that page is
stored in main memory.
Pages (1,2,5,6) - available in main memory blocks
(________) respectively.
Present bit indicates whether the page has been
transferred from auxiliary memory into main memory. (ie)
0 bit page not available in main memory
[ if bit is 0 - A call to the operating system is then generated
to fetch the required page from auxiliary memory and
place it into main memory before resuming computation]

Anda mungkin juga menyukai