SlideShare a Scribd company logo
1 of 20
MEMORY
UNIT-3
Mohammad Asif Iqbal
Assistant Professor,
Deptt of ECE,
JETGI, Barabanki
THREE PROBLEMS WITH MEMORY
Suppose we have to run a programs which requires 32 bit address space.
What if you don’t have 4GB (2^32 bytes of memory)??
Program can access any bite form the 32 bit address space.
#1:What if we don’t have enough memory?
32 bit program address
space(4GB) 30 bit RAM address space(1GB)
??
Crash if we will try to access
more than 1 GB
1 GB
How do program share the memory?
Where do we put them?
#2:Holes in our address space
32 bit program address
space(4GB)
Program 1
1 GB
Program 3
2 GB
Program 2
2 GB
1.Programs 1 and 2 fit
(they use 3 GB of memory, leaving 1GB free)
2.Quit Program 1
(program 2 uses 2GB of memory, leaving 2GB free)
3.Cant run Program 3
(even though we have enough free space)
1 GB
Memory fragmentation
#3:How do we keep program secure?
RAM address
space(4GB)
Suppose we have to run different programs. Each of them may access 32 bit address space.
What if multiple program access the same address?
- Sw R2, 1024(R0) will write to address 1024 regardless of the program that running.
Program 1
1 GB
Program 2
2 GB
1.Programs 1
Stores your bank balance at address 1024
2.Programs 2
Stores your video game score at address 1024
Program
address 1024
47001200089000
They can corrupt or crash each other: security and reliability
Problems with memory
If all programs have access to the same 32-bit memory space:
-Can crash if less than 4GB of RAM memory in the system
-Can run out of space if we run multiple programs
-Can corrupt other programs data
How do we solve this?
-key to the problem :”same memory space”
-Can we give each program it’s own virtual memory space?
-If so we can :
Separate map of each program’s memory space to the RAM memory space.
How does VM work?
Virtual and Physical address
Basic idea : separate memory spaces
- e.g. ld R4, 1024 (R0) access virtual address R0 + 1024 = 1024
-virtual memory: what the program sees
How does VM works?
-Physical memory: the physical RAM in the computer
- e.g. if you have 2GB of RAM installed, you have physical address 0 to 2^31-1
Virtual address(VA)
-What the program uses
-This is the full 32 bit address space: 0 to 2^31-1
Physical address(PA)
-What the hardware uses to talk to the RAM
-Address space determined by how much RAM is installed
Making VM works: translation
How does a program access memory?
1. Program execute a load specifying a virtual address(VA)
Processor
Ld R3, 1024 (R0)
2. Computer translate the address to the physical address (PA) in memory
Translation
from VA to
PA
RAM
Physical address
space
VA PA
512 12
786 DISK
1024 2
MAP
DATA For R3
3. if the physical address (PA) is not in memory, the operating system load it in from disk)
Ld R5, 786 (R0)
Data fro R3
Update
translati
on map
Solving the problem: #1 not enough memory
Map some of the programs address space to the disk.
When we need it, we bring it into memory
MAP
30 bit RAM address
space(1GB)
With Virtual Memory
Program address map to RAM address
Program 0
Program 0
VM maps address 0
to RAM 1
Programs loads
address 0
Programs loads
address 1
32 bit program
address space(4GB)
Program 1 Program 1
VM maps address 1
to RAM 0
Programs loads
address 2
Program 2
Program 2
VM maps address 2
to RAM 2
Programs loads
address 3
Program 3
VM doesn't have
any more space
in RAM
VM moves oldest
data (0) to disk
VM update the map to
point data 0 to disk
VM maps address 3 to
RAM 1
Program 3
Mapping lets us use
our disk to give the
illusion of unlimited
memory
Question : VM and performance
Q: What is going to happen to the
program performance when the data its
needs is on the disks and not in
memory?
oBetter performance: we can use more
memory than we have
oNothing: mapping to memory or disk
is just as easy
oWorse performance: reading from
disk is slower than RAM
A:Worse performance: reading from
disk is slower than RAM
Remember that disks are 1000x slower
than RAM. Any time you cant fit your
data to memory and have to go to disk
you pay a HUGE performance
penalty(this is why buying more RAM
makes your computer faster)
Solving the problem: #2 holes in the address space
•How do we use the holes left when program quit?
•We can map a program’s address to RAM address however we like
1 GB
1 GB
32 bit RAM
address space(4GB)
Program 1
2 GB
Program 2
2 GB
Program 2
2 GB
MAP 2
MAP 3
With Virtual Memory
Program address map to RAM address
RAM address
space(4GB)
Program 1’s and program 2’s address map to different RAM addresses
Program 1
1 GB
Program 2
2 GB
1.Programs 1
Stores your bank balance at
address 1024
2.Programs 2
Stores your video game score at
address 1024
Program 1
address 1024
Program 2
address 1024
4700
1200089000
Solving the problem: #3 keeping programs secure
With Virtual Memory
Program address map to RAM address
MAP 1
MAP 2
Because each program has its own address space, they cant access each other’s
data: security and reliability
VM maps it to RAM address 1
VM maps it to RAM address 4
Neither can touch the other’s data
Question : is program isolation is always good?
Q: virtual memory lets us isolate programs so
they cant share/corrupt data. What is the down
side of complete isolation?
oPrograms cant corrupt each other.
oProgram cant share data with each other
oProgram uses more space because they have
their own address space
oProgram are slower because they always have
to check the disk for the data
A:Program cant share data with each
other
However we can use the same mapping
to allow programs to share data by
simply having their maps point to the
same data.
The map for virtual address to physical address is the page table
So far we have had one page table entry for every virtual address.
Processor
Ld R3, 1024 (R0)
Translation
from VA to PA
RAM
Physical address space
VA PA
512 12
786 DISK
1024 2
MAP
DATA For R3
Ld R5, 786 (R0)
Data fro R3
Page Table
Program virtual
address space
Q: How many entries do we need in
our table?
•1 for every byte = 2^32 = 4 billions
•1 for every word = 2^30= 1 billion
A: 1 for every word = 2^30 = 1 billions
We have a word-aligned memory so
we need to be able to address every
word.
Pages:
Each entry now
cover 4KB of
data
Page Table size
We need to translate every possible address:
-Our program have 32-bit virtual address spaces
-That is 2^30 words that needs Page Table Entries (1 Billion entries)
-If they don’t have a page table entry then we cant access them because we
cant find the physical address
How can we make this more manageable ?
VA PA
512 12
786 DISK
1024 2
MAP
Page table
Translate VA to
PA
Fine grain:
Maps each
word address
2^30 words to
map
What if we divide memory up into chunks(pages) instead of words ?
MAP
VA PA
0-4095 4096-8191
Page table
Translate VA to
PA
Coarse grain:
Maps chunks of
address fewer
mapping
Coarse grain: pages instead of words
The page table manages the larger chunks (pages) of data
-fewer page table entries needed to cover the whole address space
MAP
VA PA
0-4095 4096-8191
Page table
Translate VA to
PA
Coarse grain:
Maps chunks of
address fewer
mapping
-But, less flexibility in how to use the RAM (have to move a page at a time)
Today:
-typically 4kB pages (1024 per page)
Q: How many entries do
we need in our Page table
for a page of length 4kB ?
•1 for every word = 2^30 =
1 billions
•1 for every 1024 word = 1
million
•1 for every 4096 word
=262144
A: 1 for every 1024 word = 1
million
With 4kB pages we have
1024 words per page. that
means we need one page
table entry for every 1024
words, so 1 billion / 1024 is
1 million page table entries.
This is much more
manageable.
Address Translation
What happen to a 32 bit machine with 256 MB of RAM and 4kB pages?
32 bit virtual address.
virtual address
28 bit physical address.
physical address
Page table
But each PTE handles
4kB of address space
For every page we have
4096 address (12 bits)
that don’t get translated
12 bits
12 bits
Page offset
Page offset
20 bits
16 bits
Virtual page address
Physical page number
32 bits
28 bits
Page offset and translation
What happen to a 32 bit machine with
256 MB of RAM and 4kB pages?
4kB
4015
0
4kB
8191
4096
4kB
12287
8192
4kB
16383
12288
Page
offset
Which
page
12 bits
Page offset
20 bits
Virtual Page number
Virtual Page number 0
Virtual Page number 1
Virtual Page number 2
Virtual Page number 3
4kB
4015
0
4kB
8191
4096
4kB
12287
8192
Virtual address space physical address space
Page
offset
Which
page
12 bits
Page offset
physical Page number 0
physical Page number 1
physical Page number 2
20 bits
physical Page numberTranslation
20 bits:
virtual
number
How to do a page table lookup
12 bits
12 bits
Page offset
Page offset
20 bits
16 bits
Virtual page address
Physical page number
32 bits
28 bits
Page table
0x00000
0x00001
0x00002
0x00003
……………
0xfffff
DISK
0x0003
0x0004
0x0006
Physical page number
0x000f6
Page table entry
tells us Which
page
11 031 12
11 027 12
0x00003204
Q:Why we have
only five bits in
this page table
for every entry?
A: Because this
representation is
in Hexadecimal
number system
Q:So now tell me
the required bits
for page offset
A: 3, obviously!!
0x204
0x204
0x204
0x00003
0x0006
204
12 bits:
page
offset
0x0006
16 bits:
physical
page
number
Q:find its physical
address
0x00000783
THANK YOU!

More Related Content

What's hot

Virtual memory
Virtual memoryVirtual memory
Virtual memoryNegar Neda
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...ITM University
 
Virtual Memory in Operating System
Virtual Memory in Operating SystemVirtual Memory in Operating System
Virtual Memory in Operating SystemMeghaj Mallick
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryMeghaj Mallick
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentationRanjeet Kumar
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Managementprimeteacher32
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory ManagementAkmal Cikmat
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsDrishti Bhalla
 

What's hot (20)

Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Ch9 Virtual Memory
Ch9 Virtual MemoryCh9 Virtual Memory
Ch9 Virtual Memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
OSCh10
OSCh10OSCh10
OSCh10
 
Virtual Memory in Operating System
Virtual Memory in Operating SystemVirtual Memory in Operating System
Virtual Memory in Operating System
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual Memory
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Unix Memory Management - Operating Systems
Unix Memory Management - Operating SystemsUnix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
 

Viewers also liked

3 d recognition via 2-d stage associative memory kunal
3 d recognition via 2-d stage associative memory kunal3 d recognition via 2-d stage associative memory kunal
3 d recognition via 2-d stage associative memory kunalKunal Kishor Nirala
 
παρουσίαση1
παρουσίαση1παρουσίαση1
παρουσίαση1dioudisd
 
Ch10: Virtual Memory
Ch10: Virtual MemoryCh10: Virtual Memory
Ch10: Virtual MemoryAhmar Hashmi
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)David Evans
 
special types of diodes Tunnel diode(1)
 special types of diodes Tunnel diode(1) special types of diodes Tunnel diode(1)
special types of diodes Tunnel diode(1)03470719974
 
06 scr & ujt
06  scr & ujt06  scr & ujt
06 scr & ujtGowtham P
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual MemoryArchith777
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryMohd Arif
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memorymyrajendra
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryvatsaanadi
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryrapunzel08
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual MemoryEmery Berger
 

Viewers also liked (17)

3 d recognition via 2-d stage associative memory kunal
3 d recognition via 2-d stage associative memory kunal3 d recognition via 2-d stage associative memory kunal
3 d recognition via 2-d stage associative memory kunal
 
Tunnel Type Paint Booth by Epcoat
Tunnel Type Paint Booth by EpcoatTunnel Type Paint Booth by Epcoat
Tunnel Type Paint Booth by Epcoat
 
L3 electronics pn junction
L3 electronics   pn junctionL3 electronics   pn junction
L3 electronics pn junction
 
παρουσίαση1
παρουσίαση1παρουσίαση1
παρουσίαση1
 
Ch10: Virtual Memory
Ch10: Virtual MemoryCh10: Virtual Memory
Ch10: Virtual Memory
 
Ch09
Ch09Ch09
Ch09
 
Os8
Os8Os8
Os8
 
Virtual Memory (Making a Process)
Virtual Memory (Making a Process)Virtual Memory (Making a Process)
Virtual Memory (Making a Process)
 
special types of diodes Tunnel diode(1)
 special types of diodes Tunnel diode(1) special types of diodes Tunnel diode(1)
special types of diodes Tunnel diode(1)
 
06 scr & ujt
06  scr & ujt06  scr & ujt
06 scr & ujt
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Vm
VmVm
Vm
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 

Similar to Virtual memory

C++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsC++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsGlobalLogic Ukraine
 
Map reduce - simplified data processing on large clusters
Map reduce - simplified data processing on large clustersMap reduce - simplified data processing on large clusters
Map reduce - simplified data processing on large clustersCleverence Kombe
 
Hadoop And Big Data - My Presentation To Selective Audience
Hadoop And Big Data - My Presentation To Selective AudienceHadoop And Big Data - My Presentation To Selective Audience
Hadoop And Big Data - My Presentation To Selective AudienceChandra Sekhar
 
Introduction To Map Reduce
Introduction To Map ReduceIntroduction To Map Reduce
Introduction To Map Reducerantav
 
Virtual memory translation.pptx
Virtual memory translation.pptxVirtual memory translation.pptx
Virtual memory translation.pptxRAJESH S
 
S3 cassandra or outer space? dumping time series data using spark
S3 cassandra or outer space? dumping time series data using sparkS3 cassandra or outer space? dumping time series data using spark
S3 cassandra or outer space? dumping time series data using sparkDemi Ben-Ari
 
Apache Spark: What's under the hood
Apache Spark: What's under the hoodApache Spark: What's under the hood
Apache Spark: What's under the hoodAdarsh Pannu
 
Memory management in sql server
Memory management in sql serverMemory management in sql server
Memory management in sql serverPrashant Kumar
 
Advanced Hadoop Tuning and Optimization
Advanced Hadoop Tuning and Optimization Advanced Hadoop Tuning and Optimization
Advanced Hadoop Tuning and Optimization Shivkumar Babshetty
 
Intro to BigData , Hadoop and Mapreduce
Intro to BigData , Hadoop and MapreduceIntro to BigData , Hadoop and Mapreduce
Intro to BigData , Hadoop and MapreduceKrishna Sangeeth KS
 
Big Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformBig Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformGeekNightHyderabad
 
Week-13-Memory Managementggvgjjjbbbb.ppt
Week-13-Memory Managementggvgjjjbbbb.pptWeek-13-Memory Managementggvgjjjbbbb.ppt
Week-13-Memory Managementggvgjjjbbbb.pptTanyaSharma662971
 
Seminar Presentation Hadoop
Seminar Presentation HadoopSeminar Presentation Hadoop
Seminar Presentation HadoopVarun Narang
 
OS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxOS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxPankaj Debbarma
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptNikhilKumarJaiswal2
 
MapReduce:Simplified Data Processing on Large Cluster Presented by Areej Qas...
MapReduce:Simplified Data Processing on Large Cluster  Presented by Areej Qas...MapReduce:Simplified Data Processing on Large Cluster  Presented by Areej Qas...
MapReduce:Simplified Data Processing on Large Cluster Presented by Areej Qas...areej qasrawi
 

Similar to Virtual memory (20)

C++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With AllocatorsC++ Advanced Memory Management With Allocators
C++ Advanced Memory Management With Allocators
 
Virtual memory (testing)
Virtual memory (testing)Virtual memory (testing)
Virtual memory (testing)
 
Map reduce - simplified data processing on large clusters
Map reduce - simplified data processing on large clustersMap reduce - simplified data processing on large clusters
Map reduce - simplified data processing on large clusters
 
Operating system
Operating systemOperating system
Operating system
 
Hadoop And Big Data - My Presentation To Selective Audience
Hadoop And Big Data - My Presentation To Selective AudienceHadoop And Big Data - My Presentation To Selective Audience
Hadoop And Big Data - My Presentation To Selective Audience
 
Introduction To Map Reduce
Introduction To Map ReduceIntroduction To Map Reduce
Introduction To Map Reduce
 
Virtual memory translation.pptx
Virtual memory translation.pptxVirtual memory translation.pptx
Virtual memory translation.pptx
 
S3 cassandra or outer space? dumping time series data using spark
S3 cassandra or outer space? dumping time series data using sparkS3 cassandra or outer space? dumping time series data using spark
S3 cassandra or outer space? dumping time series data using spark
 
Hadoop - Introduction to HDFS
Hadoop - Introduction to HDFSHadoop - Introduction to HDFS
Hadoop - Introduction to HDFS
 
Apache Spark: What's under the hood
Apache Spark: What's under the hoodApache Spark: What's under the hood
Apache Spark: What's under the hood
 
Memory management in sql server
Memory management in sql serverMemory management in sql server
Memory management in sql server
 
Basic course
Basic courseBasic course
Basic course
 
Advanced Hadoop Tuning and Optimization
Advanced Hadoop Tuning and Optimization Advanced Hadoop Tuning and Optimization
Advanced Hadoop Tuning and Optimization
 
Intro to BigData , Hadoop and Mapreduce
Intro to BigData , Hadoop and MapreduceIntro to BigData , Hadoop and Mapreduce
Intro to BigData , Hadoop and Mapreduce
 
Big Data - Need of Converged Data Platform
Big Data - Need of Converged Data PlatformBig Data - Need of Converged Data Platform
Big Data - Need of Converged Data Platform
 
Week-13-Memory Managementggvgjjjbbbb.ppt
Week-13-Memory Managementggvgjjjbbbb.pptWeek-13-Memory Managementggvgjjjbbbb.ppt
Week-13-Memory Managementggvgjjjbbbb.ppt
 
Seminar Presentation Hadoop
Seminar Presentation HadoopSeminar Presentation Hadoop
Seminar Presentation Hadoop
 
OS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptxOS-01 Virtual Memory.pptx
OS-01 Virtual Memory.pptx
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
 
MapReduce:Simplified Data Processing on Large Cluster Presented by Areej Qas...
MapReduce:Simplified Data Processing on Large Cluster  Presented by Areej Qas...MapReduce:Simplified Data Processing on Large Cluster  Presented by Areej Qas...
MapReduce:Simplified Data Processing on Large Cluster Presented by Areej Qas...
 

More from Asif Iqbal

5415Microprocessor-Lecture-11.pdf
5415Microprocessor-Lecture-11.pdf5415Microprocessor-Lecture-11.pdf
5415Microprocessor-Lecture-11.pdfAsif Iqbal
 
Chandrayaan 3.pptx
Chandrayaan 3.pptxChandrayaan 3.pptx
Chandrayaan 3.pptxAsif Iqbal
 
OPTICAL COMMUNICATION Unit 5
OPTICAL COMMUNICATION Unit 5OPTICAL COMMUNICATION Unit 5
OPTICAL COMMUNICATION Unit 5Asif Iqbal
 
OPTICAL COMMUNICATION Unit 4
OPTICAL COMMUNICATION Unit 4OPTICAL COMMUNICATION Unit 4
OPTICAL COMMUNICATION Unit 4Asif Iqbal
 
optical communication Unit 3
optical communication Unit 3optical communication Unit 3
optical communication Unit 3Asif Iqbal
 
OPTICAL COMMUNICATION Unit 2
OPTICAL COMMUNICATION Unit 2OPTICAL COMMUNICATION Unit 2
OPTICAL COMMUNICATION Unit 2Asif Iqbal
 
OPTICAL FIBER COMMUNICATION UNIT-1
OPTICAL FIBER COMMUNICATION UNIT-1OPTICAL FIBER COMMUNICATION UNIT-1
OPTICAL FIBER COMMUNICATION UNIT-1Asif Iqbal
 
Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4Asif Iqbal
 
Combinational Logic Unit 2
Combinational Logic Unit 2Combinational Logic Unit 2
Combinational Logic Unit 2Asif Iqbal
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Asif Iqbal
 
voltage regulater
 voltage regulater voltage regulater
voltage regulaterAsif Iqbal
 
oscillator unit 3
oscillator unit 3 oscillator unit 3
oscillator unit 3 Asif Iqbal
 
Nunit 2 feedback
Nunit 2 feedbackNunit 2 feedback
Nunit 2 feedbackAsif Iqbal
 
digital to analog (DAC) & analog to digital converter (ADC)
digital to analog (DAC) & analog to digital converter (ADC) digital to analog (DAC) & analog to digital converter (ADC)
digital to analog (DAC) & analog to digital converter (ADC) Asif Iqbal
 
opamp application, Bistable, astable and monostable multivibrator, IC-555 timer
opamp application, Bistable, astable and monostable multivibrator, IC-555 timeropamp application, Bistable, astable and monostable multivibrator, IC-555 timer
opamp application, Bistable, astable and monostable multivibrator, IC-555 timerAsif Iqbal
 

More from Asif Iqbal (20)

5415Microprocessor-Lecture-11.pdf
5415Microprocessor-Lecture-11.pdf5415Microprocessor-Lecture-11.pdf
5415Microprocessor-Lecture-11.pdf
 
11815939.ppt
11815939.ppt11815939.ppt
11815939.ppt
 
Chandrayaan 3.pptx
Chandrayaan 3.pptxChandrayaan 3.pptx
Chandrayaan 3.pptx
 
Memory unit 6
Memory unit 6Memory unit 6
Memory unit 6
 
instruction
instruction instruction
instruction
 
OPTICAL COMMUNICATION Unit 5
OPTICAL COMMUNICATION Unit 5OPTICAL COMMUNICATION Unit 5
OPTICAL COMMUNICATION Unit 5
 
OPTICAL COMMUNICATION Unit 4
OPTICAL COMMUNICATION Unit 4OPTICAL COMMUNICATION Unit 4
OPTICAL COMMUNICATION Unit 4
 
optical communication Unit 3
optical communication Unit 3optical communication Unit 3
optical communication Unit 3
 
OPTICAL COMMUNICATION Unit 2
OPTICAL COMMUNICATION Unit 2OPTICAL COMMUNICATION Unit 2
OPTICAL COMMUNICATION Unit 2
 
OPTICAL FIBER COMMUNICATION UNIT-1
OPTICAL FIBER COMMUNICATION UNIT-1OPTICAL FIBER COMMUNICATION UNIT-1
OPTICAL FIBER COMMUNICATION UNIT-1
 
Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4
 
Combinational Logic Unit 2
Combinational Logic Unit 2Combinational Logic Unit 2
Combinational Logic Unit 2
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:
 
voltage regulater
 voltage regulater voltage regulater
voltage regulater
 
special diode
special diodespecial diode
special diode
 
oscillator unit 3
oscillator unit 3 oscillator unit 3
oscillator unit 3
 
Nunit 2 feedback
Nunit 2 feedbackNunit 2 feedback
Nunit 2 feedback
 
digital to analog (DAC) & analog to digital converter (ADC)
digital to analog (DAC) & analog to digital converter (ADC) digital to analog (DAC) & analog to digital converter (ADC)
digital to analog (DAC) & analog to digital converter (ADC)
 
opamp application, Bistable, astable and monostable multivibrator, IC-555 timer
opamp application, Bistable, astable and monostable multivibrator, IC-555 timeropamp application, Bistable, astable and monostable multivibrator, IC-555 timer
opamp application, Bistable, astable and monostable multivibrator, IC-555 timer
 
Unit 5
Unit 5Unit 5
Unit 5
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 

Virtual memory

  • 1. MEMORY UNIT-3 Mohammad Asif Iqbal Assistant Professor, Deptt of ECE, JETGI, Barabanki
  • 2.
  • 3. THREE PROBLEMS WITH MEMORY Suppose we have to run a programs which requires 32 bit address space. What if you don’t have 4GB (2^32 bytes of memory)?? Program can access any bite form the 32 bit address space. #1:What if we don’t have enough memory? 32 bit program address space(4GB) 30 bit RAM address space(1GB) ?? Crash if we will try to access more than 1 GB
  • 4. 1 GB How do program share the memory? Where do we put them? #2:Holes in our address space 32 bit program address space(4GB) Program 1 1 GB Program 3 2 GB Program 2 2 GB 1.Programs 1 and 2 fit (they use 3 GB of memory, leaving 1GB free) 2.Quit Program 1 (program 2 uses 2GB of memory, leaving 2GB free) 3.Cant run Program 3 (even though we have enough free space) 1 GB Memory fragmentation
  • 5. #3:How do we keep program secure? RAM address space(4GB) Suppose we have to run different programs. Each of them may access 32 bit address space. What if multiple program access the same address? - Sw R2, 1024(R0) will write to address 1024 regardless of the program that running. Program 1 1 GB Program 2 2 GB 1.Programs 1 Stores your bank balance at address 1024 2.Programs 2 Stores your video game score at address 1024 Program address 1024 47001200089000 They can corrupt or crash each other: security and reliability
  • 6. Problems with memory If all programs have access to the same 32-bit memory space: -Can crash if less than 4GB of RAM memory in the system -Can run out of space if we run multiple programs -Can corrupt other programs data How do we solve this? -key to the problem :”same memory space” -Can we give each program it’s own virtual memory space? -If so we can : Separate map of each program’s memory space to the RAM memory space.
  • 7. How does VM work? Virtual and Physical address Basic idea : separate memory spaces - e.g. ld R4, 1024 (R0) access virtual address R0 + 1024 = 1024 -virtual memory: what the program sees How does VM works? -Physical memory: the physical RAM in the computer - e.g. if you have 2GB of RAM installed, you have physical address 0 to 2^31-1 Virtual address(VA) -What the program uses -This is the full 32 bit address space: 0 to 2^31-1 Physical address(PA) -What the hardware uses to talk to the RAM -Address space determined by how much RAM is installed
  • 8. Making VM works: translation How does a program access memory? 1. Program execute a load specifying a virtual address(VA) Processor Ld R3, 1024 (R0) 2. Computer translate the address to the physical address (PA) in memory Translation from VA to PA RAM Physical address space VA PA 512 12 786 DISK 1024 2 MAP DATA For R3 3. if the physical address (PA) is not in memory, the operating system load it in from disk) Ld R5, 786 (R0) Data fro R3 Update translati on map
  • 9. Solving the problem: #1 not enough memory Map some of the programs address space to the disk. When we need it, we bring it into memory MAP 30 bit RAM address space(1GB) With Virtual Memory Program address map to RAM address Program 0 Program 0 VM maps address 0 to RAM 1 Programs loads address 0 Programs loads address 1 32 bit program address space(4GB) Program 1 Program 1 VM maps address 1 to RAM 0 Programs loads address 2 Program 2 Program 2 VM maps address 2 to RAM 2 Programs loads address 3 Program 3 VM doesn't have any more space in RAM VM moves oldest data (0) to disk VM update the map to point data 0 to disk VM maps address 3 to RAM 1 Program 3 Mapping lets us use our disk to give the illusion of unlimited memory
  • 10. Question : VM and performance Q: What is going to happen to the program performance when the data its needs is on the disks and not in memory? oBetter performance: we can use more memory than we have oNothing: mapping to memory or disk is just as easy oWorse performance: reading from disk is slower than RAM A:Worse performance: reading from disk is slower than RAM Remember that disks are 1000x slower than RAM. Any time you cant fit your data to memory and have to go to disk you pay a HUGE performance penalty(this is why buying more RAM makes your computer faster)
  • 11. Solving the problem: #2 holes in the address space •How do we use the holes left when program quit? •We can map a program’s address to RAM address however we like 1 GB 1 GB 32 bit RAM address space(4GB) Program 1 2 GB Program 2 2 GB Program 2 2 GB MAP 2 MAP 3 With Virtual Memory Program address map to RAM address
  • 12. RAM address space(4GB) Program 1’s and program 2’s address map to different RAM addresses Program 1 1 GB Program 2 2 GB 1.Programs 1 Stores your bank balance at address 1024 2.Programs 2 Stores your video game score at address 1024 Program 1 address 1024 Program 2 address 1024 4700 1200089000 Solving the problem: #3 keeping programs secure With Virtual Memory Program address map to RAM address MAP 1 MAP 2 Because each program has its own address space, they cant access each other’s data: security and reliability VM maps it to RAM address 1 VM maps it to RAM address 4 Neither can touch the other’s data
  • 13. Question : is program isolation is always good? Q: virtual memory lets us isolate programs so they cant share/corrupt data. What is the down side of complete isolation? oPrograms cant corrupt each other. oProgram cant share data with each other oProgram uses more space because they have their own address space oProgram are slower because they always have to check the disk for the data A:Program cant share data with each other However we can use the same mapping to allow programs to share data by simply having their maps point to the same data.
  • 14. The map for virtual address to physical address is the page table So far we have had one page table entry for every virtual address. Processor Ld R3, 1024 (R0) Translation from VA to PA RAM Physical address space VA PA 512 12 786 DISK 1024 2 MAP DATA For R3 Ld R5, 786 (R0) Data fro R3 Page Table Program virtual address space Q: How many entries do we need in our table? •1 for every byte = 2^32 = 4 billions •1 for every word = 2^30= 1 billion A: 1 for every word = 2^30 = 1 billions We have a word-aligned memory so we need to be able to address every word.
  • 15. Pages: Each entry now cover 4KB of data Page Table size We need to translate every possible address: -Our program have 32-bit virtual address spaces -That is 2^30 words that needs Page Table Entries (1 Billion entries) -If they don’t have a page table entry then we cant access them because we cant find the physical address How can we make this more manageable ? VA PA 512 12 786 DISK 1024 2 MAP Page table Translate VA to PA Fine grain: Maps each word address 2^30 words to map What if we divide memory up into chunks(pages) instead of words ? MAP VA PA 0-4095 4096-8191 Page table Translate VA to PA Coarse grain: Maps chunks of address fewer mapping
  • 16. Coarse grain: pages instead of words The page table manages the larger chunks (pages) of data -fewer page table entries needed to cover the whole address space MAP VA PA 0-4095 4096-8191 Page table Translate VA to PA Coarse grain: Maps chunks of address fewer mapping -But, less flexibility in how to use the RAM (have to move a page at a time) Today: -typically 4kB pages (1024 per page) Q: How many entries do we need in our Page table for a page of length 4kB ? •1 for every word = 2^30 = 1 billions •1 for every 1024 word = 1 million •1 for every 4096 word =262144 A: 1 for every 1024 word = 1 million With 4kB pages we have 1024 words per page. that means we need one page table entry for every 1024 words, so 1 billion / 1024 is 1 million page table entries. This is much more manageable.
  • 17. Address Translation What happen to a 32 bit machine with 256 MB of RAM and 4kB pages? 32 bit virtual address. virtual address 28 bit physical address. physical address Page table But each PTE handles 4kB of address space For every page we have 4096 address (12 bits) that don’t get translated 12 bits 12 bits Page offset Page offset 20 bits 16 bits Virtual page address Physical page number 32 bits 28 bits
  • 18. Page offset and translation What happen to a 32 bit machine with 256 MB of RAM and 4kB pages? 4kB 4015 0 4kB 8191 4096 4kB 12287 8192 4kB 16383 12288 Page offset Which page 12 bits Page offset 20 bits Virtual Page number Virtual Page number 0 Virtual Page number 1 Virtual Page number 2 Virtual Page number 3 4kB 4015 0 4kB 8191 4096 4kB 12287 8192 Virtual address space physical address space Page offset Which page 12 bits Page offset physical Page number 0 physical Page number 1 physical Page number 2 20 bits physical Page numberTranslation
  • 19. 20 bits: virtual number How to do a page table lookup 12 bits 12 bits Page offset Page offset 20 bits 16 bits Virtual page address Physical page number 32 bits 28 bits Page table 0x00000 0x00001 0x00002 0x00003 …………… 0xfffff DISK 0x0003 0x0004 0x0006 Physical page number 0x000f6 Page table entry tells us Which page 11 031 12 11 027 12 0x00003204 Q:Why we have only five bits in this page table for every entry? A: Because this representation is in Hexadecimal number system Q:So now tell me the required bits for page offset A: 3, obviously!! 0x204 0x204 0x204 0x00003 0x0006 204 12 bits: page offset 0x0006 16 bits: physical page number Q:find its physical address 0x00000783