SlideShare a Scribd company logo
MEMORY MANAGEMENT 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7 Implementation issues 4.8 Segmentation
MEMORY MANAGEMENT Ideally programmers want memory that is large fast non volatile Memory hierarchy  small amount of fast, expensive memory – cache  some medium-speed, medium price main memory gigabytes of slow, cheap disk storage Memory manager handles the memory hierarchy
BASIC MEMORY MANAGEMENT MONOPROGRAMMING WITHOUT SWAPPING OR PAGING Three simple ways of organizing memory - an operating system with one user process
MULTIPROGRAMMING WITH FIXED PARTITIONS Fixed memory partitions separate input queues for each partition single input queue
MODELING MULTIPROGRAMMING CPU utilization as a function of number of processes in memory Degree of multiprogramming
ANALYSIS OF MULTIPROGRAMMING SYSTEM PERFORMANCE Arrival and work requirements of 4 jobs CPU utilization for 1 – 4 jobs with 80% I/O wait Sequence of events as jobs arrive and finish note numbers show amout of CPU time jobs get in each interval
RELOCATION AND PROTECTION Cannot be sure where program will be loaded in memory address locations of variables,  code routines cannot be absolute must keep a program out of other processes’ partitions Use base and limit values address locations added to base value to map to physical addr address locations larger than limit value is an error
SWAPPING (1) Memory allocation changes as  processes come into memory leave memory Shaded regions are unused memory
SWAPPING (2) Allocating space for growing data segment Allocating space for growing stack & data segment
MEMORY MANAGEMENT WITH BIT MAPS Part of memory with 5 processes, 3 holes tick marks show allocation units shaded regions are free Corresponding bit map Same information as a list
MEMORY MANAGEMENT WITH LINKED LISTS Four neighbor combinations for the terminating process X
VIRTUAL MEMORY PAGING (1) The position and function of the MMU
PAGING (2) The relation between virtual addresses and physical  memory addres- ses given by page table
PAGE  TABLES (1) Internal operation of MMU with 16 4 KB pages
PAGE TABLES (2) 32 bit address with 2 page table fields Two-level page tables Second-level page tables Top-level  page table
PAGE TABLES (3) Typical page table entry
TLBS – TRANSLATION LOOKASIDE BUFFERS A TLB to speed up paging
INVERTED PAGE TABLES Comparison of a traditional page table with an inverted page table
PAGE REPLACEMENT ALGORITHMS Page fault forces choice   which page must be removed make room for incoming page Modified page must first be saved unmodified just overwritten Better not to choose an often used page will probably need to be brought back in soon
OPTIMAL PAGE REPLACEMENT ALGORITHM Replace page needed at the farthest point in future Optimal but unrealizable Estimate by … logging page use on previous runs of  process although this is impractical
NOT RECENTLY USED PAGE REPLACEMENT ALGORITHM Each page has Reference bit, Modified bit bits are set when page is referenced, modified Pages are classified not referenced, not modified not referenced, modified referenced, not modified referenced, modified NRU removes page at random from lowest numbered non empty class
FIFO PAGE REPLACEMENT ALGORITHM Maintain a linked list of all pages   in order they came into memory Page at beginning of list replaced Disadvantage page in memory the longest may be often used
SECOND CHANCE PAGE REPLACEMENT ALGORITHM Operation of a second chance pages sorted in FIFO order Page list if fault occurs at time 20,  A  has  R  bit set (numbers above pages are loading times)
THE CLOCK PAGE REPLACEMENT ALGORITHM
LEAST RECENTLY USED (LRU) Assume pages used recently will used again soon throw out page that has been unused for longest time Must keep a linked list of pages most recently used at front, least at rear update this list  every memory reference  !! Alternatively keep counter in each page table entry choose page with lowest value counter periodically zero the counter
SIMULATING LRU IN SOFTWARE (1) LRU using a matrix – pages referenced in order 0,1,2,3,2,1,0,3,2,3
SIMULATING LRU IN SOFTWARE (2) The aging algorithm simulates LRU in software Note 6 pages for 5 clock ticks, (a) – (e)
THE WORKING SET PAGE REPLACEMENT ALGORITHM (1) The working set is the set of pages used by the  k  most recent memory references w(k,t) is the size of the working set at time,  t
THE WORKING SET PAGE REPLACEMENT ALGORITHM (2) The working set algorithm
THE WSCLOCK PAGE REPLACEMENT ALGORITHM Operation of the WSClock algorithm
REVIEW OF PAGE REPLACEMENT ALGORITHMS
MODELING PAGE REPLACEMENT ALGORITHMS BELADY'S ANOMALY FIFO with 3 page frames FIFO with 4 page frames P 's show which page references show page faults
STACK ALGORITHMS State of memory array,  M , after each item in reference string is processed 7  4  6  5
THE DISTANCE STRING Probability density functions for two hypothetical distance strings
THE DISTANCE STRING Computation of page fault rate from distance string the  C  vector the  F  vector
DESIGN ISSUES FOR PAGING SYSTEMS LOCAL VERSUS GLOBAL ALLOCATION POLICIES (1) Original configuration Local page replacement Global page replacement
LOCAL VERSUS GLOBAL ALLOCATION POLICIES (2) Page fault rate as a function of the number of page frames assigned
LOAD CONTROL Despite good designs, system may still thrash When PFF algorithm indicates  some processes need more memory  but  no  processes need less Solution : Reduce number of processes competing for memory swap one or more to disk, divide up pages they held reconsider degree of multiprogramming
PAGE SIZE (1) Small page size Advantages less internal fragmentation  better fit for various data structures, code sections less unused program in memory Disadvantages programs need many pages, larger page tables
PAGE SIZE (2) Overhead due to page table and internal fragmentation Where s = average process size in bytes p = page size in bytes e = page entry page table space internal fragmentation Optimized when
SEPARATE INSTRUCTION AND DATA SPACES One address space Separate I and D spaces
SHARED PAGES Two processes sharing same program sharing its page table
CLEANING POLICY Need for a background process, paging daemon periodically inspects state of memory When too few frames are free selects pages to evict using a replacement algorithm It can use same circular list (clock)  as regular page replacement algorithmbut with diff ptr
IMPLEMENTATION ISSUES OPERATING SYSTEM INVOLVEMENT WITH PAGING Four times when OS involved with paging Process creation determine program size create page table Process execution MMU reset for new process TLB flushed Page fault time determine virtual address causing fault swap target page out, needed page in Process termination time release page table, pages
PAGE FAULT HANDLING (1) Hardware traps to kernel General registers saved OS determines which virtual page needed OS checks validity of address, seeks page frame If selected frame is dirty, write it to disk
PAGE FAULT HANDLING (2) OS brings schedules new page in from disk Page tables updated Faulting instruction backed up to when it began  Faulting process scheduled Registers restored Program continues
INSTRUCTION BACKUP An instruction causing a page fault
LOCKING PAGES IN MEMORY Virtual memory and I/O occasionally interact Proc issues call for read from device into buffer while waiting for  I/O, another processes starts up has a page fault buffer for the first proc may be chosen to be paged out Need to specify some pages locked exempted from being target pages
BACKING STORE (a) Paging to static swap area (b) Backing up pages dynamically
SEPARATION OF POLICY AND MECHANISM Page fault handling with an external pager
SEGMENTATION (1) One-dimensional address space with growing tables One table may bump into another
SEGMENTATION (2) Allows each table to grow or shrink, independently
SEGMENTATION (3) Comparison of paging and segmentation
IMPLEMENTATION OF PURE SEGMENTATION (a)-(d) Development of checkerboarding (e) Removal of the checkerboarding by compaction
SEGMENTATION WITH PAGING: MULTICS (1) Descriptor segment points to page tables Segment descriptor – numbers are field lengths
SEGMENTATION WITH PAGING: MULTICS (2) A 34-bit MULTICS virtual address
SEGMENTATION WITH PAGING: MULTICS (3) Conversion of a 2-part MULTICS address into a main memory address
SEGMENTATION WITH PAGING: MULTICS (4) Simplified version of the  MULTICS  TLB Existence of 2 page sizes makes actual TLB more complicated
SEGMENTATION WITH PAGING: PENTIUM (1) A Pentium selector
SEGMENTATION WITH PAGING: PENTIUM (2) Pentium code segment descriptor Data segments differ slightly
SEGMENTATION WITH PAGING: PENTIUM (3) Conversion of a (selector, offset) pair to a linear address
SEGMENTATION WITH PAGING: PENTIUM (4) Mapping of a linear address onto a physical address
SEGMENTATION WITH PAGING: PENTIUM (5) Protection on the Pentium Level
Ad

More Related Content

What's hot (20)

Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Page replacement
Page replacementPage replacement
Page replacement
sashi799
 
Memory management
Memory managementMemory management
Memory management
Vishal Singh
 
Kernel I/O subsystem
Kernel I/O subsystemKernel I/O subsystem
Kernel I/O subsystem
AtiKa Bhatti
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
Venkata Sreeram
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Chapter 13 - I/O Systems
Chapter 13 - I/O SystemsChapter 13 - I/O Systems
Chapter 13 - I/O Systems
Wayne Jones Jnr
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
Archith777
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
Cs8493 unit 4
Cs8493 unit 4Cs8493 unit 4
Cs8493 unit 4
Kathirvel Ayyaswamy
 
Introduction to distributed database
Introduction to distributed databaseIntroduction to distributed database
Introduction to distributed database
Sonia Panesar
 
RAID LEVELS
RAID LEVELSRAID LEVELS
RAID LEVELS
Uzair Khan
 
Cache memory
Cache memoryCache memory
Cache memory
Ansari Maviya
 
Distributed database
Distributed databaseDistributed database
Distributed database
ReachLocal Services India
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating system
DeepikaT13
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
Mythili Kannan
 
Lecture 37
Lecture 37Lecture 37
Lecture 37
RahulRathi94
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
aaina_katyal
 
Adbms 11 object structure and type constructor
Adbms 11 object structure and type constructorAdbms 11 object structure and type constructor
Adbms 11 object structure and type constructor
Vaibhav Khanna
 
Distributed database system
Distributed database systemDistributed database system
Distributed database system
M. Ahmad Mahmood
 
Page replacement
Page replacementPage replacement
Page replacement
sashi799
 
Kernel I/O subsystem
Kernel I/O subsystemKernel I/O subsystem
Kernel I/O subsystem
AtiKa Bhatti
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
Venkata Sreeram
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
Chapter 13 - I/O Systems
Chapter 13 - I/O SystemsChapter 13 - I/O Systems
Chapter 13 - I/O Systems
Wayne Jones Jnr
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
Archith777
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ManishPrajapati78
 
Introduction to distributed database
Introduction to distributed databaseIntroduction to distributed database
Introduction to distributed database
Sonia Panesar
 
Storage management in operating system
Storage management in operating systemStorage management in operating system
Storage management in operating system
DeepikaT13
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
Mythili Kannan
 
Adbms 11 object structure and type constructor
Adbms 11 object structure and type constructorAdbms 11 object structure and type constructor
Adbms 11 object structure and type constructor
Vaibhav Khanna
 
Distributed database system
Distributed database systemDistributed database system
Distributed database system
M. Ahmad Mahmood
 

Viewers also liked (20)

Memory management
Memory managementMemory management
Memory management
Rajni Sirohi
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
Akmal Cikmat
 
Memory management
Memory managementMemory management
Memory management
Muhammad Fayyaz
 
Operating Systems and Memory Management
Operating Systems and Memory ManagementOperating Systems and Memory Management
Operating Systems and Memory Management
guest1415ae65
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
sgpraju
 
Operating Systems: Memory Management
Operating Systems: Memory ManagementOperating Systems: Memory Management
Operating Systems: Memory Management
Damian T. Gordon
 
Memory management
Memory managementMemory management
Memory management
Slideshare
 
Memory Management
Memory ManagementMemory Management
Memory Management
Visakh V
 
Software quality
Software qualitySoftware quality
Software quality
Santu Kumar
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
Santu Kumar
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
rprajat007
 
Paging
PagingPaging
Paging
guest53a712
 
Unit 4 memory system
Unit 4   memory systemUnit 4   memory system
Unit 4 memory system
chidabdu
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
Dr. Loganathan R
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
Sara Ali
 
Operating Systems: Virtual Memory
Operating Systems: Virtual MemoryOperating Systems: Virtual Memory
Operating Systems: Virtual Memory
Damian T. Gordon
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
Weng Wei
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
Bullz Musetsho
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
Akmal Cikmat
 
Operating Systems and Memory Management
Operating Systems and Memory ManagementOperating Systems and Memory Management
Operating Systems and Memory Management
guest1415ae65
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
sgpraju
 
Operating Systems: Memory Management
Operating Systems: Memory ManagementOperating Systems: Memory Management
Operating Systems: Memory Management
Damian T. Gordon
 
Memory management
Memory managementMemory management
Memory management
Slideshare
 
Memory Management
Memory ManagementMemory Management
Memory Management
Visakh V
 
Software quality
Software qualitySoftware quality
Software quality
Santu Kumar
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
Santu Kumar
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
rprajat007
 
Unit 4 memory system
Unit 4   memory systemUnit 4   memory system
Unit 4 memory system
chidabdu
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
Dr. Loganathan R
 
Deadlocks in operating system
Deadlocks in operating systemDeadlocks in operating system
Deadlocks in operating system
Sara Ali
 
Operating Systems: Virtual Memory
Operating Systems: Virtual MemoryOperating Systems: Virtual Memory
Operating Systems: Virtual Memory
Damian T. Gordon
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
Weng Wei
 
Ad

Similar to Memory Management (20)

Chapter 04
Chapter 04Chapter 04
Chapter 04
Google
 
ikh311-06
ikh311-06ikh311-06
ikh311-06
Anung Ariwibowo
 
memory
memorymemory
memory
Kishore Kumar
 
chap.4.memory.manag.ppt
chap.4.memory.manag.pptchap.4.memory.manag.ppt
chap.4.memory.manag.ppt
amadayshwan
 
4 (1)
4 (1)4 (1)
4 (1)
Mothi R
 
Distributed Operating System_3
Distributed Operating System_3Distributed Operating System_3
Distributed Operating System_3
Dr Sandeep Kumar Poonia
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
Wayne Jones Jnr
 
LRU_Replacement-Policy.pdf
LRU_Replacement-Policy.pdfLRU_Replacement-Policy.pdf
LRU_Replacement-Policy.pdf
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Hardware implementation of page table
Hardware implementation of page table Hardware implementation of page table
Hardware implementation of page table
Sukhraj Singh
 
virtual memory
virtual memoryvirtual memory
virtual memory
Abeer Naskar
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
C.U
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
Supriya Shrivastava
 
OSCh10
OSCh10OSCh10
OSCh10
Joe Christensen
 
Csc4320 chapter 8 2
Csc4320 chapter 8 2Csc4320 chapter 8 2
Csc4320 chapter 8 2
bshikhar13
 
381 ccs chapter6_updated(2)
381 ccs chapter6_updated(2)381 ccs chapter6_updated(2)
381 ccs chapter6_updated(2)
Rabie Masoud
 
Understanding operating systems 5th ed ch03
Understanding operating systems 5th ed ch03Understanding operating systems 5th ed ch03
Understanding operating systems 5th ed ch03
BarrBoy
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
Piyush Rochwani
 
Memory+management
Memory+managementMemory+management
Memory+management
Kushagra Gaur
 
Ch09
Ch09Ch09
Ch09
guest64730d
 
Cache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniquesCache replacement policies,cache miss,writingtechniques
Cache replacement policies,cache miss,writingtechniques
subhasishdas79
 
Ad

More from Ramasubbu .P (20)

radar
radarradar
radar
Ramasubbu .P
 
Press
PressPress
Press
Ramasubbu .P
 
Milling 2
Milling 2Milling 2
Milling 2
Ramasubbu .P
 
MIlling 1
MIlling 1MIlling 1
MIlling 1
Ramasubbu .P
 
Drillings
DrillingsDrillings
Drillings
Ramasubbu .P
 
Holding
HoldingHolding
Holding
Ramasubbu .P
 
Saftey
SafteySaftey
Saftey
Ramasubbu .P
 
Harvesting
HarvestingHarvesting
Harvesting
Ramasubbu .P
 
Plough
PloughPlough
Plough
Ramasubbu .P
 
Tractor PTO
Tractor PTOTractor PTO
Tractor PTO
Ramasubbu .P
 
Tractor Components
Tractor ComponentsTractor Components
Tractor Components
Ramasubbu .P
 
MSAT
MSATMSAT
MSAT
Ramasubbu .P
 
GPS
GPSGPS
GPS
Ramasubbu .P
 
RTOS
RTOSRTOS
RTOS
Ramasubbu .P
 
Virus
VirusVirus
Virus
Ramasubbu .P
 
Hacker
HackerHacker
Hacker
Ramasubbu .P
 
Denail of Service
Denail of ServiceDenail of Service
Denail of Service
Ramasubbu .P
 
RAID CONCEPT
RAID CONCEPTRAID CONCEPT
RAID CONCEPT
Ramasubbu .P
 
Network Security
Network SecurityNetwork Security
Network Security
Ramasubbu .P
 
Timer
TimerTimer
Timer
Ramasubbu .P
 

Recently uploaded (20)

The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 

Memory Management

  • 1. MEMORY MANAGEMENT 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7 Implementation issues 4.8 Segmentation
  • 2. MEMORY MANAGEMENT Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory – cache some medium-speed, medium price main memory gigabytes of slow, cheap disk storage Memory manager handles the memory hierarchy
  • 3. BASIC MEMORY MANAGEMENT MONOPROGRAMMING WITHOUT SWAPPING OR PAGING Three simple ways of organizing memory - an operating system with one user process
  • 4. MULTIPROGRAMMING WITH FIXED PARTITIONS Fixed memory partitions separate input queues for each partition single input queue
  • 5. MODELING MULTIPROGRAMMING CPU utilization as a function of number of processes in memory Degree of multiprogramming
  • 6. ANALYSIS OF MULTIPROGRAMMING SYSTEM PERFORMANCE Arrival and work requirements of 4 jobs CPU utilization for 1 – 4 jobs with 80% I/O wait Sequence of events as jobs arrive and finish note numbers show amout of CPU time jobs get in each interval
  • 7. RELOCATION AND PROTECTION Cannot be sure where program will be loaded in memory address locations of variables, code routines cannot be absolute must keep a program out of other processes’ partitions Use base and limit values address locations added to base value to map to physical addr address locations larger than limit value is an error
  • 8. SWAPPING (1) Memory allocation changes as processes come into memory leave memory Shaded regions are unused memory
  • 9. SWAPPING (2) Allocating space for growing data segment Allocating space for growing stack & data segment
  • 10. MEMORY MANAGEMENT WITH BIT MAPS Part of memory with 5 processes, 3 holes tick marks show allocation units shaded regions are free Corresponding bit map Same information as a list
  • 11. MEMORY MANAGEMENT WITH LINKED LISTS Four neighbor combinations for the terminating process X
  • 12. VIRTUAL MEMORY PAGING (1) The position and function of the MMU
  • 13. PAGING (2) The relation between virtual addresses and physical memory addres- ses given by page table
  • 14. PAGE TABLES (1) Internal operation of MMU with 16 4 KB pages
  • 15. PAGE TABLES (2) 32 bit address with 2 page table fields Two-level page tables Second-level page tables Top-level page table
  • 16. PAGE TABLES (3) Typical page table entry
  • 17. TLBS – TRANSLATION LOOKASIDE BUFFERS A TLB to speed up paging
  • 18. INVERTED PAGE TABLES Comparison of a traditional page table with an inverted page table
  • 19. PAGE REPLACEMENT ALGORITHMS Page fault forces choice which page must be removed make room for incoming page Modified page must first be saved unmodified just overwritten Better not to choose an often used page will probably need to be brought back in soon
  • 20. OPTIMAL PAGE REPLACEMENT ALGORITHM Replace page needed at the farthest point in future Optimal but unrealizable Estimate by … logging page use on previous runs of process although this is impractical
  • 21. NOT RECENTLY USED PAGE REPLACEMENT ALGORITHM Each page has Reference bit, Modified bit bits are set when page is referenced, modified Pages are classified not referenced, not modified not referenced, modified referenced, not modified referenced, modified NRU removes page at random from lowest numbered non empty class
  • 22. FIFO PAGE REPLACEMENT ALGORITHM Maintain a linked list of all pages in order they came into memory Page at beginning of list replaced Disadvantage page in memory the longest may be often used
  • 23. SECOND CHANCE PAGE REPLACEMENT ALGORITHM Operation of a second chance pages sorted in FIFO order Page list if fault occurs at time 20, A has R bit set (numbers above pages are loading times)
  • 24. THE CLOCK PAGE REPLACEMENT ALGORITHM
  • 25. LEAST RECENTLY USED (LRU) Assume pages used recently will used again soon throw out page that has been unused for longest time Must keep a linked list of pages most recently used at front, least at rear update this list every memory reference !! Alternatively keep counter in each page table entry choose page with lowest value counter periodically zero the counter
  • 26. SIMULATING LRU IN SOFTWARE (1) LRU using a matrix – pages referenced in order 0,1,2,3,2,1,0,3,2,3
  • 27. SIMULATING LRU IN SOFTWARE (2) The aging algorithm simulates LRU in software Note 6 pages for 5 clock ticks, (a) – (e)
  • 28. THE WORKING SET PAGE REPLACEMENT ALGORITHM (1) The working set is the set of pages used by the k most recent memory references w(k,t) is the size of the working set at time, t
  • 29. THE WORKING SET PAGE REPLACEMENT ALGORITHM (2) The working set algorithm
  • 30. THE WSCLOCK PAGE REPLACEMENT ALGORITHM Operation of the WSClock algorithm
  • 31. REVIEW OF PAGE REPLACEMENT ALGORITHMS
  • 32. MODELING PAGE REPLACEMENT ALGORITHMS BELADY'S ANOMALY FIFO with 3 page frames FIFO with 4 page frames P 's show which page references show page faults
  • 33. STACK ALGORITHMS State of memory array, M , after each item in reference string is processed 7 4 6 5
  • 34. THE DISTANCE STRING Probability density functions for two hypothetical distance strings
  • 35. THE DISTANCE STRING Computation of page fault rate from distance string the C vector the F vector
  • 36. DESIGN ISSUES FOR PAGING SYSTEMS LOCAL VERSUS GLOBAL ALLOCATION POLICIES (1) Original configuration Local page replacement Global page replacement
  • 37. LOCAL VERSUS GLOBAL ALLOCATION POLICIES (2) Page fault rate as a function of the number of page frames assigned
  • 38. LOAD CONTROL Despite good designs, system may still thrash When PFF algorithm indicates some processes need more memory but no processes need less Solution : Reduce number of processes competing for memory swap one or more to disk, divide up pages they held reconsider degree of multiprogramming
  • 39. PAGE SIZE (1) Small page size Advantages less internal fragmentation better fit for various data structures, code sections less unused program in memory Disadvantages programs need many pages, larger page tables
  • 40. PAGE SIZE (2) Overhead due to page table and internal fragmentation Where s = average process size in bytes p = page size in bytes e = page entry page table space internal fragmentation Optimized when
  • 41. SEPARATE INSTRUCTION AND DATA SPACES One address space Separate I and D spaces
  • 42. SHARED PAGES Two processes sharing same program sharing its page table
  • 43. CLEANING POLICY Need for a background process, paging daemon periodically inspects state of memory When too few frames are free selects pages to evict using a replacement algorithm It can use same circular list (clock) as regular page replacement algorithmbut with diff ptr
  • 44. IMPLEMENTATION ISSUES OPERATING SYSTEM INVOLVEMENT WITH PAGING Four times when OS involved with paging Process creation determine program size create page table Process execution MMU reset for new process TLB flushed Page fault time determine virtual address causing fault swap target page out, needed page in Process termination time release page table, pages
  • 45. PAGE FAULT HANDLING (1) Hardware traps to kernel General registers saved OS determines which virtual page needed OS checks validity of address, seeks page frame If selected frame is dirty, write it to disk
  • 46. PAGE FAULT HANDLING (2) OS brings schedules new page in from disk Page tables updated Faulting instruction backed up to when it began Faulting process scheduled Registers restored Program continues
  • 47. INSTRUCTION BACKUP An instruction causing a page fault
  • 48. LOCKING PAGES IN MEMORY Virtual memory and I/O occasionally interact Proc issues call for read from device into buffer while waiting for I/O, another processes starts up has a page fault buffer for the first proc may be chosen to be paged out Need to specify some pages locked exempted from being target pages
  • 49. BACKING STORE (a) Paging to static swap area (b) Backing up pages dynamically
  • 50. SEPARATION OF POLICY AND MECHANISM Page fault handling with an external pager
  • 51. SEGMENTATION (1) One-dimensional address space with growing tables One table may bump into another
  • 52. SEGMENTATION (2) Allows each table to grow or shrink, independently
  • 53. SEGMENTATION (3) Comparison of paging and segmentation
  • 54. IMPLEMENTATION OF PURE SEGMENTATION (a)-(d) Development of checkerboarding (e) Removal of the checkerboarding by compaction
  • 55. SEGMENTATION WITH PAGING: MULTICS (1) Descriptor segment points to page tables Segment descriptor – numbers are field lengths
  • 56. SEGMENTATION WITH PAGING: MULTICS (2) A 34-bit MULTICS virtual address
  • 57. SEGMENTATION WITH PAGING: MULTICS (3) Conversion of a 2-part MULTICS address into a main memory address
  • 58. SEGMENTATION WITH PAGING: MULTICS (4) Simplified version of the MULTICS TLB Existence of 2 page sizes makes actual TLB more complicated
  • 59. SEGMENTATION WITH PAGING: PENTIUM (1) A Pentium selector
  • 60. SEGMENTATION WITH PAGING: PENTIUM (2) Pentium code segment descriptor Data segments differ slightly
  • 61. SEGMENTATION WITH PAGING: PENTIUM (3) Conversion of a (selector, offset) pair to a linear address
  • 62. SEGMENTATION WITH PAGING: PENTIUM (4) Mapping of a linear address onto a physical address
  • 63. SEGMENTATION WITH PAGING: PENTIUM (5) Protection on the Pentium Level