SlideShare a Scribd company logo
COMPUTER SCIENCE AND DATA PROCESSING
DEPARTMENT OF MATHEMATICS
IIT KHARAGPUR
Virtual Memory
Abir Naskar
13MA60R21
• Why virtual memory?
• Motivations.
• Memory hierarchy.
• Cache and Virtual memory.
• Paging.
• References.
OUTLINE
1
• Extension of main memory.
• Secondary storage is used.
• Combination of hardware and software.
• Usually very large.
• Working set of pages resides in main memory, others are
in secondary memory.
VIRTUAL MEMORY
2
• Main memory is expensive.
• Main memory size is less.
• All program are not active.
• Multiprogramming environment.
• Time sharing.
• Allow OS to share memory.
• Protect program from each other.
WHY VIRTUAL MEMORY
3
• We use main memory as a cache of disk
memory.
- address space of process can exceed physical memory size.
• Simplify memory management.
- only active code and data is actually in memory.
• Provide protection.
- one process can’t interfere with another.
MOTIVATION
4
LEVELS IN MEMORY HIERARCHY
Size 32B 32KB-4MB 128MB 30GB
Speed 3ns 6ns 60ns 8ms
5
SYSTEM WITH PYHSICAL MEMORY ONLY
 Address generated by CPU point directly to
byte in physical memory.
 Example: Cray machines, early PCs,
embedded systems etc.
6
SYSTEM WITH VIRTUAL MEMORY
o Hardware converts virtual address to
physical addresses via an OS-managed
look-up table (page table).
o Example : modern PCs, workstations,
servers etc.
7
CACHE MEMORY VIRTUAL MEMORY
Is a hardware or processor Is simulated on hard drive maintained by OS
Data reads in unit called “block” Data reads in unit called “pages”
Stores memory access by CPU Storage swapping between active storage and
hard disk
Reduces the frequency that the CPU must wait for
data from the main memory
Reduces the amount of physical storage access
that is required
Performance-wise faster Performance-wise slower
CACHE MEMORY VS VIRTUAL MEMORY
8
• It is a Memory Management Technique in which the memory is divided
into fixed size pages.
• Paging is used for faster access of data.
• Paging allows the physical address space of a process to be noncontiguous.
• A page is a sequence of N bytes where N is a power of 2.
• Page size should be high enough to amortize the high access time, and
page fault rate is small.
• These days, page sizes are at least 4KB.
• If 1Mb RAM, then 1MB/4KB=256 pages.
PAGING
9
• Virtual address contains virtual page number and page offset.
• The number of pages addressable with virtual address is virtually unlimited
where number of pages addressable with physical address is limited.
• Mapping from virtual to a physical address.
ADDRESS MAPPING
10
• A data may be or may not be present in main memory- if not present then
page fault occur.
• OS takes control when the valid bit is 0.
* OS creates pages for all the process in the disk.
* It also creates a data structure to record where each virtual page is stored in the disk.
* Another data structure to track which process and virtual address use physical page.
PAGE FAULT
11
• Find a free frame to store a desire page.
* If there is free frame use it.
* Otherwise use a page replacement algorithm to find a victim page.
* Write the victim page on disk and change the page and page table accordingly.
• Read the desired page into free frame and change the page and page table.
• Restart the user process.
• Some page replacement algorithm:
FIFO replacement, Least Recently Used replacement, Least Frequently
Used replacement etc.
PAGE REPLACEMENT
12
13
• Page table is a data structure to store the mapping between virtual address
and physical address.
• Used to translate logical to physical addresses.
• Page table entries:
Address: pointer to the location of page in memory.
Valid bit: where page is pointed.
Dirty bit: set if at least one word of the page is modified.
Referenced bit: set if page has been referenced with either read or write.
protection bit: used to restrict access, like read only, system only access.
PAGE TABLE
• Applications run slower.
• It takes more time to switch between applications.
• Less hard drive space for your use.
DISADVANTAGES
14
• Stallings W. (2006): “Operating Systems: Internals and Design Principles (7th Edition)”. prentice hall.
• Tanenbaum A. S. (2013): “Modern Operating System (3rd edition)”,
Pearson Education, pp.175-247.
• Cragon, Harvey G. (1996). Memory Systems
and Pipelined Processors. Jones and Bartlett Publishers.
ISBN 0-86720-474-5.
• URL: http://windows.microsoft.com/en-us/windows/what-is-virtual-memory#1TC=windows-7
• URL: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Memory/virtual.html
REFERENCES
15
Thank you…

More Related Content

What's hot

Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
primeteacher32
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
Mustafa Ugur Oduncu
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
jeyaperumal
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Muhammad Farooq
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Asif Iqbal
 
virtual memory
virtual memoryvirtual memory
virtual memory
Abeer Naskar
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
RITULDE
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
Farzan Dehbashi
 
Massive Storage Engine
Massive Storage EngineMassive Storage Engine
Massive Storage Engine
Varnish Software
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
Ranjeet Kumar
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
tamizh arthanari
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
Damian T. Gordon
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
Piyush Rochwani
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
vampugani
 
basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
Adarsh Patel
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
Santu Kumar
 
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
 
Hugepage
HugepageHugepage
Hugepage
Buland Singh
 
Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6 Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6
Raghu Udiyar
 

What's hot (19)

Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Massive Storage Engine
Massive Storage EngineMassive Storage Engine
Massive Storage Engine
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 
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...
 
Hugepage
HugepageHugepage
Hugepage
 
Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6 Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6
 

Similar to The life and times

Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
RahulRaj395610
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
Amanuelmergia
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
Mazin Alwaaly
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
SujanTimalsina5
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
Harika Pudugosula
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
SandhyaTatekalva
 
Chapter08
Chapter08Chapter08
Segmentation and paging
Segmentation and paging Segmentation and paging
Segmentation and paging
RohanSharma573161
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Auxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptxAuxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptx
Ramakrishna Reddy Bijjam
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
Vandana Salve
 
Abhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptxAbhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptx
wemoji5816
 
Vm
VmVm
Introduction to memory management
Introduction to memory managementIntroduction to memory management
Introduction to memory management
Sweety Singhal
 
Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014
marvin herrera
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
ssusera387fd1
 
Managing Memory & Locks - Series 1 Memory Management
Managing  Memory & Locks - Series 1 Memory ManagementManaging  Memory & Locks - Series 1 Memory Management
Managing Memory & Locks - Series 1 Memory Management
DAGEOP LTD
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
Sher Shah Merkhel
 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memory
PrakharBansal29
 
CSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual MemoryCSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual Memory
ghayour abbas
 

Similar to The life and times (20)

Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Chapter08
Chapter08Chapter08
Chapter08
 
Segmentation and paging
Segmentation and paging Segmentation and paging
Segmentation and paging
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Auxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptxAuxiliary, Cache and Virtual memory.pptx
Auxiliary, Cache and Virtual memory.pptx
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
 
Abhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptxAbhaycavirtual memory and the pagehit.pptx
Abhaycavirtual memory and the pagehit.pptx
 
Vm
VmVm
Vm
 
Introduction to memory management
Introduction to memory managementIntroduction to memory management
Introduction to memory management
 
Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014Colvin exadata mistakes_ioug_2014
Colvin exadata mistakes_ioug_2014
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Managing Memory & Locks - Series 1 Memory Management
Managing  Memory & Locks - Series 1 Memory ManagementManaging  Memory & Locks - Series 1 Memory Management
Managing Memory & Locks - Series 1 Memory Management
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Cache memory and virtual memory
Cache memory and virtual memoryCache memory and virtual memory
Cache memory and virtual memory
 
CSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual MemoryCSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual Memory
 

Recently uploaded

How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 

Recently uploaded (20)

How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 

The life and times

  • 1. COMPUTER SCIENCE AND DATA PROCESSING DEPARTMENT OF MATHEMATICS IIT KHARAGPUR Virtual Memory Abir Naskar 13MA60R21
  • 2. • Why virtual memory? • Motivations. • Memory hierarchy. • Cache and Virtual memory. • Paging. • References. OUTLINE 1
  • 3. • Extension of main memory. • Secondary storage is used. • Combination of hardware and software. • Usually very large. • Working set of pages resides in main memory, others are in secondary memory. VIRTUAL MEMORY 2
  • 4. • Main memory is expensive. • Main memory size is less. • All program are not active. • Multiprogramming environment. • Time sharing. • Allow OS to share memory. • Protect program from each other. WHY VIRTUAL MEMORY 3
  • 5. • We use main memory as a cache of disk memory. - address space of process can exceed physical memory size. • Simplify memory management. - only active code and data is actually in memory. • Provide protection. - one process can’t interfere with another. MOTIVATION 4
  • 6. LEVELS IN MEMORY HIERARCHY Size 32B 32KB-4MB 128MB 30GB Speed 3ns 6ns 60ns 8ms 5
  • 7. SYSTEM WITH PYHSICAL MEMORY ONLY  Address generated by CPU point directly to byte in physical memory.  Example: Cray machines, early PCs, embedded systems etc. 6
  • 8. SYSTEM WITH VIRTUAL MEMORY o Hardware converts virtual address to physical addresses via an OS-managed look-up table (page table). o Example : modern PCs, workstations, servers etc. 7
  • 9. CACHE MEMORY VIRTUAL MEMORY Is a hardware or processor Is simulated on hard drive maintained by OS Data reads in unit called “block” Data reads in unit called “pages” Stores memory access by CPU Storage swapping between active storage and hard disk Reduces the frequency that the CPU must wait for data from the main memory Reduces the amount of physical storage access that is required Performance-wise faster Performance-wise slower CACHE MEMORY VS VIRTUAL MEMORY 8
  • 10. • It is a Memory Management Technique in which the memory is divided into fixed size pages. • Paging is used for faster access of data. • Paging allows the physical address space of a process to be noncontiguous. • A page is a sequence of N bytes where N is a power of 2. • Page size should be high enough to amortize the high access time, and page fault rate is small. • These days, page sizes are at least 4KB. • If 1Mb RAM, then 1MB/4KB=256 pages. PAGING 9
  • 11. • Virtual address contains virtual page number and page offset. • The number of pages addressable with virtual address is virtually unlimited where number of pages addressable with physical address is limited. • Mapping from virtual to a physical address. ADDRESS MAPPING 10
  • 12. • A data may be or may not be present in main memory- if not present then page fault occur. • OS takes control when the valid bit is 0. * OS creates pages for all the process in the disk. * It also creates a data structure to record where each virtual page is stored in the disk. * Another data structure to track which process and virtual address use physical page. PAGE FAULT 11
  • 13. • Find a free frame to store a desire page. * If there is free frame use it. * Otherwise use a page replacement algorithm to find a victim page. * Write the victim page on disk and change the page and page table accordingly. • Read the desired page into free frame and change the page and page table. • Restart the user process. • Some page replacement algorithm: FIFO replacement, Least Recently Used replacement, Least Frequently Used replacement etc. PAGE REPLACEMENT 12
  • 14. 13 • Page table is a data structure to store the mapping between virtual address and physical address. • Used to translate logical to physical addresses. • Page table entries: Address: pointer to the location of page in memory. Valid bit: where page is pointed. Dirty bit: set if at least one word of the page is modified. Referenced bit: set if page has been referenced with either read or write. protection bit: used to restrict access, like read only, system only access. PAGE TABLE
  • 15. • Applications run slower. • It takes more time to switch between applications. • Less hard drive space for your use. DISADVANTAGES 14
  • 16. • Stallings W. (2006): “Operating Systems: Internals and Design Principles (7th Edition)”. prentice hall. • Tanenbaum A. S. (2013): “Modern Operating System (3rd edition)”, Pearson Education, pp.175-247. • Cragon, Harvey G. (1996). Memory Systems and Pipelined Processors. Jones and Bartlett Publishers. ISBN 0-86720-474-5. • URL: http://windows.microsoft.com/en-us/windows/what-is-virtual-memory#1TC=windows-7 • URL: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Memory/virtual.html REFERENCES 15