SlideShare a Scribd company logo
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Operating System
KCS – 401
Virtual Memory
Dr. Pankaj Kumar
Associate Professor – CSE
SRMGPC Lucknow
Background
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Code needs to be in memory to execute, but entire program rarely used
Error code, unusual routines, large data structures
Entire program code not needed at same time
Consider ability to execute partially-loaded program
Program no longer constrained by limits of physical memory
Each program takes less memory while running -> more programs run at the same time
Increased CPU utilization and throughput with no increase in response time or
turnaround time
Less I/O needed to load or swap programs into memory -> each user program runs faster
Virtual Memory
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Virtual memory – separation of user logical memory
from physical memory
Only part of the program needs to be in memory for
execution
Logical address space can therefore be much larger
than physical address space
Allows address spaces to be shared by several
processes
Allows for more efficient process creation
More programs running concurrently
Less I/O needed to load or swap processes
Virtual Memory
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Virtual address space – logical view of how process is stored in memory
Usually start at address 0, contiguous addresses until end of space
Meanwhile, physical memory organized in page frames
MMU must map logical to physical
Virtual memory can be implemented via:
Demand paging
Demand segmentation
Usually design logical address space for stack to start at Max logical address
and grow “down” while heap grows “up”
Maximizes address space use
Unused address space between the two is hole
No physical memory needed until heap or stack grows to a given
new page
Enables sparse address spaces with holes left for growth, dynamically linked
libraries, etc
Virtual Memory
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
Virtual address space – logical view of how process is stored in memory
Usually start at address 0, contiguous addresses until end of space
Meanwhile, physical memory organized in page frames
MMU must map logical to physical
Virtual memory can be implemented via:
Demand paging
Demand segmentation
Usually design logical address space for stack to start at Max logical address
and grow “down” while heap grows “up”
Maximizes address space use
Unused address space between the two is hole
No physical memory needed until heap or stack grows to a given
new page
Enables sparse address spaces with holes left for growth, dynamically linked
libraries, etc
Page Fault
B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar
If there is a reference to a page, first reference to
that page will trap to operating system:
page fault
1.Operating system looks at another table to decide:
Invalid reference  abort
Just not in memory
2.Find free frame
3.Swap page into frame via scheduled disk operation
4.Reset tables to indicate page now in memory
Set validation bit = v
5.Restart the instruction that caused the page fault

More Related Content

PPTX
Operating system 36 virtual memory
PDF
OS virtual memory
PPT
Chapter 09 - Virtual Memory.ppt
PDF
Virtual memory
PDF
CH09.pdf
PPTX
Os Module 4_Virtual Memory Management.pptx
PPT
NOV11 virtual memory.ppt
PPT
virtual memory.ppt
Operating system 36 virtual memory
OS virtual memory
Chapter 09 - Virtual Memory.ppt
Virtual memory
CH09.pdf
Os Module 4_Virtual Memory Management.pptx
NOV11 virtual memory.ppt
virtual memory.ppt

Similar to Virtual Memory (20)

PPT
Mca ii os u-4 memory management
PPTX
VIRTUAL 2.pptx
PPT
memory management and Virtual Memory.ppt
PPT
Cache replacement policies,cache miss,writingtechniques
PPT
Virtual memory - Demand Paging
PPT
Power Point Presentation on Virtual Memory.ppt
PPT
NOV11 virtual memory.ppt
PPT
Virtual memory
PPT
Virtual Memory
PDF
EECS3221-w11m1-VirtualMemory.pdf
PPTX
Virtual Memory.pptx
PDF
CS6401 OPERATING SYSTEMS Unit 3
PDF
The life and times
PPTX
Lecture 8- Virtual Memory Final.pptx
PPTX
Virtual Memory Management
DOCX
virtual memory
PPTX
Computer architecture virtual memory
PPTX
virtual memory
PDF
Cs8493 unit 3
Mca ii os u-4 memory management
VIRTUAL 2.pptx
memory management and Virtual Memory.ppt
Cache replacement policies,cache miss,writingtechniques
Virtual memory - Demand Paging
Power Point Presentation on Virtual Memory.ppt
NOV11 virtual memory.ppt
Virtual memory
Virtual Memory
EECS3221-w11m1-VirtualMemory.pdf
Virtual Memory.pptx
CS6401 OPERATING SYSTEMS Unit 3
The life and times
Lecture 8- Virtual Memory Final.pptx
Virtual Memory Management
virtual memory
Computer architecture virtual memory
virtual memory
Cs8493 unit 3

More from Shri Ram Swaroop Memorial College of Engineering & Management (19)

PDF
Operating System: Process and synchronization
PDF
Operating System: interprocess Communication
Operating System: Process and synchronization
Operating System: interprocess Communication

Recently uploaded (20)

PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
advance database management system book.pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
Introduction to pro and eukaryotes and differences.pptx
PPTX
Introduction to Building Materials
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Indian roads congress 037 - 2012 Flexible pavement
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
FORM 1 BIOLOGY MIND MAPS and their schemes
advance database management system book.pdf
B.Sc. DS Unit 2 Software Engineering.pptx
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Introduction to pro and eukaryotes and differences.pptx
Introduction to Building Materials
Chinmaya Tiranga quiz Grand Finale.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Share_Module_2_Power_conflict_and_negotiation.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Weekly quiz Compilation Jan -July 25.pdf
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf

Virtual Memory

  • 1. B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Operating System KCS – 401 Virtual Memory Dr. Pankaj Kumar Associate Professor – CSE SRMGPC Lucknow
  • 2. Background B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Code needs to be in memory to execute, but entire program rarely used Error code, unusual routines, large data structures Entire program code not needed at same time Consider ability to execute partially-loaded program Program no longer constrained by limits of physical memory Each program takes less memory while running -> more programs run at the same time Increased CPU utilization and throughput with no increase in response time or turnaround time Less I/O needed to load or swap programs into memory -> each user program runs faster
  • 3. Virtual Memory B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Virtual memory – separation of user logical memory from physical memory Only part of the program needs to be in memory for execution Logical address space can therefore be much larger than physical address space Allows address spaces to be shared by several processes Allows for more efficient process creation More programs running concurrently Less I/O needed to load or swap processes
  • 4. Virtual Memory B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Virtual address space – logical view of how process is stored in memory Usually start at address 0, contiguous addresses until end of space Meanwhile, physical memory organized in page frames MMU must map logical to physical Virtual memory can be implemented via: Demand paging Demand segmentation Usually design logical address space for stack to start at Max logical address and grow “down” while heap grows “up” Maximizes address space use Unused address space between the two is hole No physical memory needed until heap or stack grows to a given new page Enables sparse address spaces with holes left for growth, dynamically linked libraries, etc
  • 5. Virtual Memory B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar Virtual address space – logical view of how process is stored in memory Usually start at address 0, contiguous addresses until end of space Meanwhile, physical memory organized in page frames MMU must map logical to physical Virtual memory can be implemented via: Demand paging Demand segmentation Usually design logical address space for stack to start at Max logical address and grow “down” while heap grows “up” Maximizes address space use Unused address space between the two is hole No physical memory needed until heap or stack grows to a given new page Enables sparse address spaces with holes left for growth, dynamically linked libraries, etc
  • 6. Page Fault B.Tech – CS 2nd Year Operating System (KCS- 401) Dr. Pankaj Kumar If there is a reference to a page, first reference to that page will trap to operating system: page fault 1.Operating system looks at another table to decide: Invalid reference  abort Just not in memory 2.Find free frame 3.Swap page into frame via scheduled disk operation 4.Reset tables to indicate page now in memory Set validation bit = v 5.Restart the instruction that caused the page fault