0% found this document useful (0 votes)
7 views7 pages

Understanding Virtual Memory Concepts

Virtual memory allows a system to have more memory addresses than the amount of physical memory available. It does this through: 1) Dividing memory into pages and swapping pages between RAM and disk as needed. 2) Giving each process its own virtual address space separate from physical addresses and other processes' spaces. 3) Detecting "page faults" when a process tries to access a page not currently in RAM, then loading that page from disk transparently. This approach maximizes available memory for programs while protecting processes from each other through isolation of their address spaces.

Uploaded by

technijanaka
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

Understanding Virtual Memory Concepts

Virtual memory allows a system to have more memory addresses than the amount of physical memory available. It does this through: 1) Dividing memory into pages and swapping pages between RAM and disk as needed. 2) Giving each process its own virtual address space separate from physical addresses and other processes' spaces. 3) Detecting "page faults" when a process tries to access a page not currently in RAM, then loading that page from disk transparently. This approach maximizes available memory for programs while protecting processes from each other through isolation of their address spaces.

Uploaded by

technijanaka
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Virtual Memory

Lecture 18:
Virtual Memory # # " ! % +, " %!% ( -

. % #/%!% ( #" % #

0 " "! % # "" "


0 . % "" " ! #" % ""
0 #" % "" " #" %% (

! "#
0 #" %% # "+
1
$%
%&''
0x800 Disk:
Mem:0x803C4
0x3C00
(
)* ! "
Virtual address Physical address

Virtual Memory

Virtual Memory

1
Virtual Memory: Take 1 A System with Only Physical Memory

2 # # % ( "+ 4 % "/ 2 " # " %# " %# %%


0 " ! % #" "+ "#" " )

0 2 # "3 % ! "
Store 0x10

0 "" % ! 3 # #
" "" "
Load 0xf0

" ! % # + #% + ( %%
"

A System with Virtual Memory Page Faults (Similar to “Cache Misses”)

4 % "/ 3 +" " " ! " " ) 5 ( 6 " "+ #7


) % " ! % "" " #
&) % " !+ ! ( "+ #
0 "" " " " " "
0 "( %
% %! % )

Store 0x10

Load 0xf0 Load 0x05

Working
Store 0xf8
Set
Virtual Memory: Take 2

%# 4 " 3 %% ( #
0 " " "" "" "
0 8 " "" " # (% (3 9 )
0 5 " 3 %% 4 %#7
0 * 9 + 3
0 2 # %%#

Virtual Memory 0 " % "%# ( 3 1


0 8 # (

2 " ! % # !
"
(% 3

Separate Virtual Address Spaces Motivation: Process Protection


% # " "" " (
0 "" ""3 ! % "
""
0 : 3 ( " " ; (
0 %
" 3 ! %" "
" #
" % #
!% "<

# $ $ $ & ' &


& ) (
&
!
) ) *
!" ! ! +++++++
' ! , , ,
, , ,
, , ,
" #$
% $ & ' &
&
%" ) ) .
!
' !
- ) (
( !
! +++++++
, , ,
, , ,
, , ,
Virtual Memory: Take 3

" 4" "+


0 = " " " #6" + "
"+ ("
0 %# (
( % "

" ! % # ! ( #
" %
Virtual Memory % (

Levels in Memory Hierarchy Virtual Memory

> " %+ " " ((


0 ? ( %"
0 . %2 #? % # % %"
. , -% , . /,

@% +" %% "
0 ! % "" "" " (
$ 0 ! %
) " %&& , - % / , + 0 ( , !% . ( , %& 3 , 0 ((" ( % ;
% 3 " ( ""<
" - 1 1& .
* +( " * !& & +( , * ! 2 & +( , * & & 2 +( ,
) " . , -% , . /, Virtual page number Page offset
31 11 0
4 4
Page Tables Page Tables

Each process gets its own page table, why?


Can’t Execute From Here

Page Faults Servicing a Page Fault

@% +" %% " ) 2+" # #3 #


" % "
+
8 % " "% ! % #
" % " 0 $ "
0 = % %#
7

2"" " %% (%"; % " 4 <


0 = ! ( "+ &)
0 " %3 " "
" " *2
0 : "" %# " ( %#% ; 3 7
<
0 *2 %
%3" "
" " %
"
0 = (%" "
0 % ( % " " (3 " ( 3 ) " "
"A" %
0 " 3 ? " 4 "! " 3 + 0 *" " #( "
" "

Virtual page number Page offset


31 11 0
Servicing a Page Fault Where Is the Page Table?

! 6 , 9
) "" %" %%
,= % + (% $
- 9
" "+ "
"B 5
" " #
""C-
&) *2 = "
(( 6+
6+
) D %
% %
"
% 6+
6+
0 D " "" ((
0 " "" "
"
% 5( $ 7 8
5 5

Making Translation Faster: The TLB TLB Design Issues


Translation Look-Aside Buffer
"" ( E %#/ " "

8 @2"" D! %!" ; ( " 3 ( %<


/
) %% %
&)D! + #" ;
3 "7
<
)= 8 %
)5 # 8 @;! % #7
<
)= "
MIPS.
F)= " (
Another HW Option?
TLB Design Issues Loading Your Program: A Neat Trick

% %# 3 3 8 @ "" "/ ) " + "


#" 3 "
"
&) " %( " ""
0 (%%#? "" ! " ? "" ! ) 2 +% % % " " !% 3
"+ (
0 ( (%%# "" ! " "" ! ) = (%
(" " )
0 4 " +
0 " %%# &G & F " ;"" ! #<

Process Interactions Virtual Memory Summary

. % "" " "" . % # ! "


4 3 / ! ," -/ " % ;8@=< 0 "
0 D
%% " (% #
0 ;
3 ! 3 ( "+ " ! <
8 @7
0 % $% " 8 @
0 . %2 # E " 3 " # #
0 !# ( 4 "3
"" " " % " 8 @)
0 = (%% ( 3 "" #" " (8 @ "" "
0 H '' % + #% "
0 8 " 3 # ""
0 8 @ ""
0 % D% "" D
*8 3 8@ #
0 ( %
0 D (" 3 "" " ""
0 ""
0 I ! 3 " #" % "
Caches and virtual memory?

You might also like