SlideShare a Scribd company logo
1 of 26
Operating System
Main Memory
Memory Management
Memory Accessing
- Registers
- Cache
- Main Memory
Stall
Hardware Address Protection
Base and Limit Registers
Address Binding
Input Queue
- Single-tasking Procedure
Binding
- Mapping of symbolic into logical Address
Steps of Binding
- Compile Time
- Load Time
- Execution Time
Logical vs Physical Address Space
Logical Address
- Logical Address Space
Physical Address
- Physical Address Space
Memory Management Unit (MMU)
Loading when called.
Better memory utilization.
Useful when large amount of code needs to
be handled.
Dynamic relocation using a
relocation register
Mapping of virtual into Physical Address
- Relocation Registers
- MS-DOS on Intel 80x86 used 4 relocation registers
Dynamic Linking
Static linking
Stub Program
Libraries
- shared libraries
Swapping
A process can be swapped temporarily out of memory to a backing
store, and then brought back into memory for continued execution
Standard Swapping
Standard swapping involves moving processes between main memory
and Baking store.
• Backing store
• Roll out, roll in
• transfer time
• ready queue
Schematic View of Swapping
Context Switch Time including Swapping
• If next processes to be put on CPU is not in memory, need to swap out
a process and swap in target process
• Context switch time can then be very high
• 100MB process swapping to hard disk with transfer rate of 50MB/sec
• Swapping is constrained by other factors as well.
Pending I/O
Double buffering
Standard swapping not used in modern operating systems
Swapping on Mobile Systems
• Not typically supported
• Flash memory based
• Small amount of space
• Limited number of write cycles
• Poor throughput between flash memory and CPU on
mobile platform
• Instead use other methods to free memory if low
iOS asks
Read-only data
Failure to free
application state
Contiguous Memory Allocation
The main memory must accommodate
both the operating system and the
various user processes.
Main memory usually into two partitions.
- Resident operating system.
- User processes.
- single contiguous section.
• Relocation registers used to protect user processes
-Base register
-Limit register
-MMU maps
-transient
Memory Protection
Memory Allocation
Multiple-partition allocation
• Degree of multiprogramming limited by number of
partitions
• Variable-partition
• Hole
• process arrival
• Operating system maintains information about:
a) allocated partitions b) free partitions (hole)
Dynamic Storage-Allocation Problem
• which concerns how to satisfy a request of size n from a
list of free holes.
• First-fit
• Best-fit
• Worst-fit
Fragmentation
• External Fragmentation
• Internal Fragmentation
Reduce external fragmentation by compaction
• Shuffle
• Compaction
• I/O problem
Segmentation
Memory segmentation is the division of a computer's
primary memory into segments or sections.
A program is a collection of segments.
A segment is a logical unit such as.
- main program
- procedure
- local variables
- global variables
User’s View of a Program Logical View of Segmentation
1
3
2
4
1
4
2
3
user space physical memory space
Segmentation Architecture
Logical address consists of a two tuple
<segment-number, offset>
Segment table.
- Base
- Limit
Segment-table base register (STBR)
Segment-table length register (STLR)
Protection
With each entry in segment table associate:
validation bit = 0  illegal segment
read/write/execute privileges
Protection bits
segments length
Segmentation Hardware
Paging
• Physical address space of a process can be noncontiguous;
process is allocated physical memory whenever the latter is
available
• Avoids external fragmentation
• Avoids problem of varying sized memory chunks
• Frames
• Pages
• Set up a page table to translate logical to physical addresses
• Backing store likewise split into pages
• Still have Internal fragmentation
Address Translation Scheme
Address generated by CPU is divided into:
• Page number (p) – used as an index into a page table which
contains base address of each page in physical memory
• Page offset (d) – combined with base address to define the physical
memory address that is sent to the memory unit
page number page offset
p d
m -n n
• For given logical address space 2m and page size 2n
Paging Model of Logical and Physical Memory
Paging Hardware
• Each operating system has its own methods for storing page
tables.
• Some allocate a page table for each process.
• When the dispatcher is told to start a process, it must reload the user
registers and define the correct hardware page-table values from the
stored user page table.
• The hardware implementation of the page table can be
done in several ways.
In the simplest case
The page table is implemented as a set of
dedicated registers.
• Page-table base register (PTBR) points to the
page table.
Page-table Base Register (PTBR)
• The standard solution to this problem is to
use a special, small, fastlookup hardware
cache called a translation look-aside buffer
(TLB).
• The percentage of times that the page number of
interest is found in the TLB is called the hit ratio.
Protection
Memory protection in a paged environment is accomplished by protection bits
associated with each frame.
• One bit can define a page to be read–write or read-
only.
Valid–Invalid Bit
• One additional bit is generally attached
to each entry in the page table: a
valid–invalid bit.
Shared Pages
• An advantage of paging is the possibility of
sharing common code.
• This consideration is particularly important in a
time-sharing environment.
• If the text editor consists of 150 KB of code and 50 KB of data space,
we need 8,000 KB to support the 40 users.
• If the code is reentrant code (or pure code),
Sharing Of code in Paging environment

More Related Content

What's hot

Memory management ppt
Memory management pptMemory management ppt
Memory management pptManishaJha43
 
Computer memory management
Computer memory managementComputer memory management
Computer memory managementKumar
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementAjit Nayak
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsPeter Tröger
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory managementMukesh Chinta
 
Memory management
Memory managementMemory management
Memory managementPATELARCH
 
Memory management
Memory managementMemory management
Memory managementSlideshare
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationBalaji Vignesh
 

What's hot (20)

Memory Management
Memory ManagementMemory Management
Memory Management
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
Computer memory management
Computer memory managementComputer memory management
Computer memory management
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management Concepts
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
 
Memory management
Memory managementMemory management
Memory management
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Operating system
Operating systemOperating system
Operating system
 
Memory management
Memory managementMemory management
Memory management
 
Memory management
Memory managementMemory management
Memory management
 
Operating System
Operating SystemOperating System
Operating System
 
Ch8
Ch8Ch8
Ch8
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O Organization
 
OSCh14
OSCh14OSCh14
OSCh14
 
Os4
Os4Os4
Os4
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 

Similar to Main Memory

Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for allVSKAMCSPSGCT
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptxItechAnand1
 
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docxPAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docxImranBhatti58
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxAmanuelmergia
 
Bab 4
Bab 4Bab 4
Bab 4n k
 
CSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxCSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxMadhuraK13
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportdilip kumar
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportBitta_man
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportAnwal Mirza
 
Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptxSourabhRaj29
 
Operating system 34 contiguous allocation
Operating system 34 contiguous allocationOperating system 34 contiguous allocation
Operating system 34 contiguous allocationVaibhav Khanna
 
Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OSC.U
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Managementdonny101
 

Similar to Main Memory (20)

Os4
Os4Os4
Os4
 
Memory Management in Operating Systems for all
Memory Management in Operating Systems for allMemory Management in Operating Systems for all
Memory Management in Operating Systems for all
 
Unit-4 swapping.pptx
Unit-4 swapping.pptxUnit-4 swapping.pptx
Unit-4 swapping.pptx
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
PAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docxPAGIN AND SEGMENTATION.docx
PAGIN AND SEGMENTATION.docx
 
Ch8 main memory
Ch8   main memoryCh8   main memory
Ch8 main memory
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
Bab 4
Bab 4Bab 4
Bab 4
 
CSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxCSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptx
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptx
 
Operating system 34 contiguous allocation
Operating system 34 contiguous allocationOperating system 34 contiguous allocation
Operating system 34 contiguous allocation
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OS
 
Ch8
Ch8Ch8
Ch8
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Management
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 

More from Usama ahmad

Assembly language
Assembly language Assembly language
Assembly language Usama ahmad
 
Non-Current Assets & Depreciation
Non-Current Assets & DepreciationNon-Current Assets & Depreciation
Non-Current Assets & DepreciationUsama ahmad
 
MANAGEMENT PROCESS HRM PROCESS
MANAGEMENT PROCESS HRM PROCESSMANAGEMENT PROCESS HRM PROCESS
MANAGEMENT PROCESS HRM PROCESSUsama ahmad
 
INTERNET AND E-COMMERCE
INTERNET AND E-COMMERCEINTERNET AND E-COMMERCE
INTERNET AND E-COMMERCEUsama ahmad
 
Introduction to Set Theory
Introduction to Set TheoryIntroduction to Set Theory
Introduction to Set TheoryUsama ahmad
 
MAGNITUDE COMPARATOR & DECODER
MAGNITUDE COMPARATOR & DECODERMAGNITUDE COMPARATOR & DECODER
MAGNITUDE COMPARATOR & DECODERUsama ahmad
 
Present of Raid and Its Type
Present of Raid and Its TypePresent of Raid and Its Type
Present of Raid and Its TypeUsama ahmad
 

More from Usama ahmad (7)

Assembly language
Assembly language Assembly language
Assembly language
 
Non-Current Assets & Depreciation
Non-Current Assets & DepreciationNon-Current Assets & Depreciation
Non-Current Assets & Depreciation
 
MANAGEMENT PROCESS HRM PROCESS
MANAGEMENT PROCESS HRM PROCESSMANAGEMENT PROCESS HRM PROCESS
MANAGEMENT PROCESS HRM PROCESS
 
INTERNET AND E-COMMERCE
INTERNET AND E-COMMERCEINTERNET AND E-COMMERCE
INTERNET AND E-COMMERCE
 
Introduction to Set Theory
Introduction to Set TheoryIntroduction to Set Theory
Introduction to Set Theory
 
MAGNITUDE COMPARATOR & DECODER
MAGNITUDE COMPARATOR & DECODERMAGNITUDE COMPARATOR & DECODER
MAGNITUDE COMPARATOR & DECODER
 
Present of Raid and Its Type
Present of Raid and Its TypePresent of Raid and Its Type
Present of Raid and Its Type
 

Recently uploaded

Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 

Recently uploaded (20)

Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 

Main Memory

  • 2. Memory Management Memory Accessing - Registers - Cache - Main Memory Stall Hardware Address Protection Base and Limit Registers
  • 3. Address Binding Input Queue - Single-tasking Procedure Binding - Mapping of symbolic into logical Address Steps of Binding - Compile Time - Load Time - Execution Time
  • 4. Logical vs Physical Address Space Logical Address - Logical Address Space Physical Address - Physical Address Space Memory Management Unit (MMU) Loading when called. Better memory utilization. Useful when large amount of code needs to be handled. Dynamic relocation using a relocation register Mapping of virtual into Physical Address - Relocation Registers - MS-DOS on Intel 80x86 used 4 relocation registers
  • 5. Dynamic Linking Static linking Stub Program Libraries - shared libraries
  • 6. Swapping A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution Standard Swapping Standard swapping involves moving processes between main memory and Baking store. • Backing store • Roll out, roll in • transfer time • ready queue
  • 7. Schematic View of Swapping
  • 8. Context Switch Time including Swapping • If next processes to be put on CPU is not in memory, need to swap out a process and swap in target process • Context switch time can then be very high • 100MB process swapping to hard disk with transfer rate of 50MB/sec • Swapping is constrained by other factors as well. Pending I/O Double buffering Standard swapping not used in modern operating systems
  • 9. Swapping on Mobile Systems • Not typically supported • Flash memory based • Small amount of space • Limited number of write cycles • Poor throughput between flash memory and CPU on mobile platform • Instead use other methods to free memory if low iOS asks Read-only data Failure to free application state
  • 10. Contiguous Memory Allocation The main memory must accommodate both the operating system and the various user processes. Main memory usually into two partitions. - Resident operating system. - User processes. - single contiguous section.
  • 11. • Relocation registers used to protect user processes -Base register -Limit register -MMU maps -transient Memory Protection
  • 12. Memory Allocation Multiple-partition allocation • Degree of multiprogramming limited by number of partitions • Variable-partition • Hole • process arrival • Operating system maintains information about: a) allocated partitions b) free partitions (hole)
  • 13. Dynamic Storage-Allocation Problem • which concerns how to satisfy a request of size n from a list of free holes. • First-fit • Best-fit • Worst-fit
  • 14. Fragmentation • External Fragmentation • Internal Fragmentation Reduce external fragmentation by compaction • Shuffle • Compaction • I/O problem
  • 15. Segmentation Memory segmentation is the division of a computer's primary memory into segments or sections. A program is a collection of segments. A segment is a logical unit such as. - main program - procedure - local variables - global variables
  • 16. User’s View of a Program Logical View of Segmentation 1 3 2 4 1 4 2 3 user space physical memory space
  • 17. Segmentation Architecture Logical address consists of a two tuple <segment-number, offset> Segment table. - Base - Limit Segment-table base register (STBR) Segment-table length register (STLR) Protection With each entry in segment table associate: validation bit = 0  illegal segment read/write/execute privileges Protection bits segments length
  • 19. Paging • Physical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter is available • Avoids external fragmentation • Avoids problem of varying sized memory chunks • Frames • Pages • Set up a page table to translate logical to physical addresses • Backing store likewise split into pages • Still have Internal fragmentation
  • 20. Address Translation Scheme Address generated by CPU is divided into: • Page number (p) – used as an index into a page table which contains base address of each page in physical memory • Page offset (d) – combined with base address to define the physical memory address that is sent to the memory unit page number page offset p d m -n n • For given logical address space 2m and page size 2n
  • 21. Paging Model of Logical and Physical Memory
  • 22. Paging Hardware • Each operating system has its own methods for storing page tables. • Some allocate a page table for each process. • When the dispatcher is told to start a process, it must reload the user registers and define the correct hardware page-table values from the stored user page table. • The hardware implementation of the page table can be done in several ways. In the simplest case The page table is implemented as a set of dedicated registers.
  • 23. • Page-table base register (PTBR) points to the page table. Page-table Base Register (PTBR) • The standard solution to this problem is to use a special, small, fastlookup hardware cache called a translation look-aside buffer (TLB). • The percentage of times that the page number of interest is found in the TLB is called the hit ratio.
  • 24. Protection Memory protection in a paged environment is accomplished by protection bits associated with each frame. • One bit can define a page to be read–write or read- only. Valid–Invalid Bit • One additional bit is generally attached to each entry in the page table: a valid–invalid bit.
  • 25. Shared Pages • An advantage of paging is the possibility of sharing common code. • This consideration is particularly important in a time-sharing environment. • If the text editor consists of 150 KB of code and 50 KB of data space, we need 8,000 KB to support the 40 users. • If the code is reentrant code (or pure code),
  • 26. Sharing Of code in Paging environment