SlideShare a Scribd company logo
Memory management
Background
• Program must be brought (from disk) into memory and placed within
a process for it to be run
● Main memory and registers are only storage CPU can access directly
● Memory unit only sees a stream of addresses + read requests, or
address + data and write requests
● Register access in one CPU clock (or less)
• Cache sits between main memory and CPU registers
• Protection of memory required to ensure correct operation
Functions/ requirements
• 1) address binding
• 2)dynamic loading
• 3)dynamic linking
• 4)logical & physical address space
• 5)overlays
Address Binding
• Address binding is a technique of generating addresses to the
instruction of programs
• Address binding is the process of mapping from one address space to
another address space.
• Address binding of instructions and data to memory addresses can
happen at three different stages
Compile time:
Load time:
Execution time
Binding of Instructions and Data to Memory
• Compile time: If memory location known a priori, absolute code can be
generated; must recompile code if starting location changes
• Load time: Must generate relocatable code if memory location is not known
at compile time
• Execution time: Binding delayed until run time if the process can be moved
during its execution from one memory segment to another
Logical vs. Physical Address Space
• Logical address – generated by the CPU; also referred to as virtual address
• Physical address – address seen by the memory unit
• The run time mapping from a logical address to physical address is done by a
hardware device called MMU.
• Logical address space is the set of all logical addresses generated by a
program
• Physical address space is the set of all physical addresses generated
by a program
Dynamic relocation using a relocation register
Hardware device that at run time
maps virtual to physical
address
● To start, consider simple scheme
where the value in the
relocation register is added to every
address generated by a
user process at the time it is sent to
memory
● Base register now called
relocation register
Dynamic loading
• With dynamic loading, a routine is not loaded until it is called.
• All routines are kept on disk in a relocatable load format.
• The main program is loaded into memory and is executed. When a routine
needs to call another routine, the calling routine first checks to see whether
the other routine has been loaded.
• If not, the relocatable linking loader is called to load the desired routine into
memory and to update the program's address tables to reflect this change.
• Then control is passed to the newly loaded routine.
• The advantage of dynamic loading is that an unused routine is never
loaded.
Dynamic linking
• In static linking, the system libraries are treated like any other object
modules and combined by the loader into the executing program.
• The dynamic linking, similar to dynamic loading is delayed until run-time.
• With static linking library modules get fully included in executable
modules, wasting both disk space and main memory usage, because every
program that included a certain routine from the library would have to
have their own copy of that routine linked into their executable code.
• With dynamic linking, however, only a stub is linked into the executable
module, containing references to the actual library module linked in at run
time.
• This method saves disk space, because the library routines do not need to be fully
included in the executable modules, only the stubs.
swapping
• A process must be in the main memory before it starts execution.
• So, a process that is ready for execution is brought in the main memory.
• Now, if a running the process gets blocked.
• The memory manager temporarily swaps out that blocked process on to
the disk.
• This makes the space for another process in the main memory.
• So, the memory manager swaps in the process ready for execution, in the
main memory, from the disk.
• The swapped out process is also brought back into the main memory
when it again gets ready for execution.
Memory protection
Relocation registers used to protect user
processes from each other, and from
changing operating-system code and
data
• Base register contains value of
smallest physical address
• Limit register contains range of
logical addresses – each logical
address must be less than the
limit register
• MMU maps logical address
dynamically
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management
Memory management

More Related Content

What's hot

Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
Transweb Global Inc
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
ManishaJha43
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
Maitree Patel
 
Memory management
Memory managementMemory management
Memory management
Mohamed Safraz
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
Aisyah Rafiuddin
 
Memory management
Memory managementMemory management
Memory management
cpjcollege
 
Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
Johan Granados Montero
 
Memory Management
Memory ManagementMemory Management
Memory Management
DEDE IRYAWAN
 
Computer memory management
Computer memory managementComputer memory management
Computer memory managementKumar
 
Memory management OS
Memory management OSMemory management OS
Memory management OS
UmeshchandraYadav5
 
Memory management
Memory managementMemory management
Memory management
Vishal Singh
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
Mukesh Chinta
 
Memory managment
Memory managmentMemory managment
Memory managment
Shahbaz Khan
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
sanjana mun
 
Memory Management
Memory ManagementMemory Management
Memory Management
lavanya marichamy
 
Storage management
Storage managementStorage management
Storage management
Atul Sharma
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
Santu Kumar
 

What's hot (20)

Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Memory management
Memory managementMemory management
Memory management
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Memory management
Memory managementMemory management
Memory management
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Memory management
Memory managementMemory management
Memory management
 
Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Computer memory management
Computer memory managementComputer memory management
Computer memory management
 
Memory management OS
Memory management OSMemory management OS
Memory management OS
 
Memory management
Memory managementMemory management
Memory management
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
 
Memory managment
Memory managmentMemory managment
Memory managment
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Storage management
Storage managementStorage management
Storage management
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 

Similar to Memory management

Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
Amanuelmergia
 
Memory Management Strategies - I.pdf
Memory Management Strategies - I.pdfMemory Management Strategies - I.pdf
Memory Management Strategies - I.pdf
Harika Pudugosula
 
Memory Management.pdf
Memory Management.pdfMemory Management.pdf
Memory Management.pdf
SujanTimalsina5
 
Operating system 32 logical versus physical address
Operating system 32 logical versus physical addressOperating system 32 logical versus physical address
Operating system 32 logical versus physical address
Vaibhav Khanna
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
LeahRachael
 
Operating systems- Main Memory Management
Operating systems- Main Memory ManagementOperating systems- Main Memory Management
Operating systems- Main Memory Management
Chandrakant Divate
 
Ch8 main memory
Ch8   main memoryCh8   main memory
Ch8 main memory
Welly Dian Astika
 
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
VSKAMCSPSGCT
 
CSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxCSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptx
MadhuraK13
 
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptxMEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
22bec032
 
Memory Management Strategies - II.pdf
Memory Management Strategies - II.pdfMemory Management Strategies - II.pdf
Memory Management Strategies - II.pdf
Harika Pudugosula
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
JayeshGadhave1
 
memory managment on computer science.ppt
memory managment on computer science.pptmemory managment on computer science.ppt
memory managment on computer science.ppt
footydigarse
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
Bitta_man
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
dilip kumar
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
ssuser000e54
 
lecture 8 b main memory
lecture 8 b main memorylecture 8 b main memory
lecture 8 b main memory
ITNet
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
morganjohn3
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
Anwal Mirza
 

Similar to Memory management (20)

Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
Memory Management Strategies - I.pdf
Memory Management Strategies - I.pdfMemory Management Strategies - I.pdf
Memory Management Strategies - I.pdf
 
Memory Management.pdf
Memory Management.pdfMemory Management.pdf
Memory Management.pdf
 
Operating system 32 logical versus physical address
Operating system 32 logical versus physical addressOperating system 32 logical versus physical address
Operating system 32 logical versus physical address
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
 
Operating systems- Main Memory Management
Operating systems- Main Memory ManagementOperating systems- Main Memory Management
Operating systems- Main Memory Management
 
Ch8 main memory
Ch8   main memoryCh8   main memory
Ch8 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 all
 
CSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxCSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptx
 
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptxMEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
 
Memory Management Strategies - II.pdf
Memory Management Strategies - II.pdfMemory Management Strategies - II.pdf
Memory Management Strategies - II.pdf
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
memory managment on computer science.ppt
memory managment on computer science.pptmemory managment on computer science.ppt
memory managment on computer science.ppt
 
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
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
 
lecture 8 b main memory
lecture 8 b main memorylecture 8 b main memory
lecture 8 b main memory
 
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
Module 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModule 2 - PPT.pdfModul...
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

Memory management

  • 2. Background • Program must be brought (from disk) into memory and placed within a process for it to be run ● Main memory and registers are only storage CPU can access directly ● Memory unit only sees a stream of addresses + read requests, or address + data and write requests ● Register access in one CPU clock (or less) • Cache sits between main memory and CPU registers • Protection of memory required to ensure correct operation
  • 3. Functions/ requirements • 1) address binding • 2)dynamic loading • 3)dynamic linking • 4)logical & physical address space • 5)overlays
  • 4. Address Binding • Address binding is a technique of generating addresses to the instruction of programs • Address binding is the process of mapping from one address space to another address space. • Address binding of instructions and data to memory addresses can happen at three different stages Compile time: Load time: Execution time
  • 5. Binding of Instructions and Data to Memory • Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes • Load time: Must generate relocatable code if memory location is not known at compile time • Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another
  • 6.
  • 7. Logical vs. Physical Address Space • Logical address – generated by the CPU; also referred to as virtual address • Physical address – address seen by the memory unit • The run time mapping from a logical address to physical address is done by a hardware device called MMU. • Logical address space is the set of all logical addresses generated by a program • Physical address space is the set of all physical addresses generated by a program
  • 8. Dynamic relocation using a relocation register Hardware device that at run time maps virtual to physical address ● To start, consider simple scheme where the value in the relocation register is added to every address generated by a user process at the time it is sent to memory ● Base register now called relocation register
  • 9. Dynamic loading • With dynamic loading, a routine is not loaded until it is called. • All routines are kept on disk in a relocatable load format. • The main program is loaded into memory and is executed. When a routine needs to call another routine, the calling routine first checks to see whether the other routine has been loaded. • If not, the relocatable linking loader is called to load the desired routine into memory and to update the program's address tables to reflect this change. • Then control is passed to the newly loaded routine. • The advantage of dynamic loading is that an unused routine is never loaded.
  • 10. Dynamic linking • In static linking, the system libraries are treated like any other object modules and combined by the loader into the executing program. • The dynamic linking, similar to dynamic loading is delayed until run-time. • With static linking library modules get fully included in executable modules, wasting both disk space and main memory usage, because every program that included a certain routine from the library would have to have their own copy of that routine linked into their executable code. • With dynamic linking, however, only a stub is linked into the executable module, containing references to the actual library module linked in at run time. • This method saves disk space, because the library routines do not need to be fully included in the executable modules, only the stubs.
  • 11. swapping • A process must be in the main memory before it starts execution. • So, a process that is ready for execution is brought in the main memory. • Now, if a running the process gets blocked. • The memory manager temporarily swaps out that blocked process on to the disk. • This makes the space for another process in the main memory. • So, the memory manager swaps in the process ready for execution, in the main memory, from the disk. • The swapped out process is also brought back into the main memory when it again gets ready for execution.
  • 12.
  • 13. Memory protection Relocation registers used to protect user processes from each other, and from changing operating-system code and data • Base register contains value of smallest physical address • Limit register contains range of logical addresses – each logical address must be less than the limit register • MMU maps logical address dynamically