Docsity

Understanding Virtual Memory: Concepts, Techniques, and Mapping, Slides of Computer Architecture and Organization

Partial preview of the text

Download Understanding Virtual Memory: Concepts, Techniques, and Mapping and more Slides Computer Architecture and Organization in PDF only on Docsity!

Memory System Design II

Virtual Memory

Memory in different programming

environment

Memory



The solution is Virtual Memory (VM)

Introduction



Virtual memory

■

Solves problem of limited memory space

■

Creates the illusion that more memory exists thanis available in system

■

Two types of addresses in virtual memorysystems

  • Virtual addresses

–Referenced by processes

  • Physical addresses

–Describes locations in main memory

■

Memory management unit (MMU)

  • Translates virtual addresses to physical

address

Virtual Memory – Memory Management

Unit

The position and function of the MMU

Virtual Memory (VM)

Virtual memory of process on disk

Real memory of system

Map (translate)virtual address to real

(Pure) Paging



Virtual and real memory are divided intofixed sized

pages



Programs are divided into pages



A process address (both in virtual & realmemory) has two components

Page

Offset within page

Mapping Virtual Memory to Physical

Memory

Physical Memory

Virtual Memory

Stack Heap Static Code

64 MB



Divide into equal sizedchunks (“page” of about 4KB)



Any chunk of Virtual Memoryassigned to any chunk ofPhysical Memory

©Javaid Khurshid

The relation between virtual addresses

and physical memory addresses

64K Virtual

Memory

32K Real Memory

Paging (Cont.)



When process pages are transferredfrom VM to real memory, page numbersmust be mapped from virtual to realmemory addresses



This mapping is done by software &hardware



When the process is started only thefirst page (main) is loaded. Other pagesare loaded on

demand

Page Tables



Index of page table is the virtual page #

Page Table

0

Page frame # Page protectionReference bitModification bit

Validity bit

Page Table Entry

1 2 3 4 5 6 7 8

Page Table Entry Fields



Validity bit is set when the page is inmemory



Reference bit is set by the hardwarewhenever the page is referred



Modified bit is set whenever the page ismodified



Page-protection bits set the accessrights (eg., read, write restrictions)

Direct Mapping



The virtual address issued by the processoris divided into two fields:

■

The virtual page number field and

■

The offset field.



If the number of bits in the virtual pagenumber field is

N,

then the number of entries

in the page table will be 2

N

©Javaid Khurshid

Direct Mapping