SlideShare a Scribd company logo
UNIT-II
Memory Management:
Early Systems
Introduction
• Management of main memory is critical.
• The performance of the entire system has been directly
dependent on two things:
• How much memory is available
• How it is optimization while jobs are being processed.
• This chapter introduces:
• The memory manager (RAM)
• Core memory (primary storage)
Introduction
• This chapter introduces:
• Four types of memory allocation schemes
• Single-user systems
• Fixed partitions
• Dynamic partitions
• Relocatable dynamic partitions
• These early memory management schemes are seldom
used by today’s OSs but are important to study because
each one introduced fundamental concepts that helped
memory management evolve.
Single-User Contiguous Scheme
• Commercially available in 1940s and 1950s
• Each program was loaded in its entirety into memory and
allocated as much contiguous memory space allocated as
it needed.
• If the program was too large and didn’t fit the
available memory space, it couldn’t be executed,
• Although early computers were physically large, they had
very little memory.
• Computers have only a finite amount of memory.
Single-User Contiguous Scheme
• If a program doesn’t fit, then either the size of the main
memory must be increased or the program must be
modified.
• Making it smaller
• Using methods that allow program segments
(partitions made to the program) to be overlaid.
• Transfer segments of a program from secondary
storage into main memory for execution
• Two or more segments take turns occupying the
same memory locations.
Memory Management
Concurrency
• A program cannot process data it does not have.
• A program spends more time waiting for I/O than
processing data.
Single-User Contiguous Scheme
• The amount of work performed by the Memory Manager is
minimal.
• Only two hardware items are needed:
• A register to store the base address
• An accumulator to keep track of the size of the program
as it’s being read into memory.
• Once the program is entirely loaded into memory, it
remains there until execution is complete, either through
normal termination or by intervention of the OS.
Single-User Contiguous Scheme
(cont'd.)
• Disadvantages
• There is no support for multiprogramming or networking
• It can handle only one job at a time.
• This configuration was first used in research institutions
but proved unacceptable for the business community.
• It was not cost effective to spend almost $200,000 for
equipment that could be used by only one person ay a
time.
Fixed Partitions
• The first attempt to follow multiprogramming used fixed
partitions (static partitions) within main memory.
• One partition for each job.
• The size of each partition was designated when the system
was powered on.
• Each partition could only be reconfigured when the
system was shut down.
• Once the system was in operation, the partition sizes
remained static.
Fixed Partitions
• Introduced protection of the job’s memory space
• Once a partition was assigned to a job, no other job could be allowed
to enter its boundaries, either accidentally or intentionally.
• Not a problem in single-user contiguous allocation schemes.
• Fixed Partitions is more flexible than the Single-User scheme
because it allows several programs to be in memory at the
same time.
• Fixed Partitions still requires that the entire program be
stored contiguously and in memory from the beginning to the
end of its execution.
Fixed Partitions
• In order to allocate memory spaces to jobs, the OS’s Memory
Manager must keep a table which shows:
• Each memory partition size
• Its address
• Its access restrictions
• Its current status (free or busy)
• As each job terminates, the status of its memory partition is
changed from busy to free so an incoming job can be assigned
to that partition.
Fixed Partitions (cont'd.)
• Disadvantages
• The Fixed Partition scheme works well if all the jobs run on
the system are of the same size or if the sizes are known
ahead of time and don’t vary between reconfiguration.
• If the partition sizes are too small:
• larger jobs will be rejected if they’re too big to fit into the
largest partition.
• Large jobs will wait if the large partitions are busy.
• Large jobs may have a longer turnaround time as they
wait for free partitions of sufficient size or may never run.
Fixed Partitions (cont'd.)
• Disadvantages
• If the partition sizes are too big, memory is wasted.
• If a job does not occupy the entire partition, the unused
memory in the partition will remain idle.
• It can’t be given to another job because each partition is
allocated to only one job at a time.
• Partial usage of fixed partitions and the coinciding creation
of unused spaces within the partition is called internal
fragmentation and is a major drawback to the fixed
partition memory allocation scheme.
Dynamic Partitions
• With Dynamic Partitions available memory is still kept in
contiguous blocks but jobs are given only as much memory as
they request when they are loaded for processing.
• A dynamic partition scheme fully utilizes memory when the
first jobs are loaded.
• As new jobs enter the system that are not the same size as
those that just vacated memory, they are fit into the available
spaces on a priority basis.
• First Come – First Serve priority
Dynamic Partitions
• The subsequent allocation of memory creates fragments
of free memory between blocks of allocated memory.
• External fragmentation
• Lets memory go to waste
Dynamic Partitions (cont'd.)
Best-FitVersus First-Fit Allocation
• For both fixed and dynamic memory allocation schemes, the
OS must keep lists of each memory location noting which are
free and which are busy.
• As new jobs come into the system, the free partitions must be
allocated.
• These partitions may be allocated on the basis of:
• First-fit memory allocation:
• First partition fitting the requirements
• Best-fit memory allocation:
• Smallest partition fitting the requirements
• Least wasted space
Best-FitVersus First-FitAllocation
(cont'd.)
Best-FitVersus First-Fit Allocation
(cont'd.)
Best-FitVersus First-Fit Allocation
(cont'd.)
• Algorithm for first-fit
• Assumes memory manager keeps two lists
• One for free memory blocks
• One for busy memory blocks
• The operation consists of a simple loop that compares
the size of each job to the size of each memory block until
a block is found that is large enough to fit the job.
• The job is stored into that block of memory and the
Memory Manager moves out of the loop to fetch the next
job from the entry queue
Best-FitVersus First-Fit Allocation
(cont'd.)
• Algorithm for first-fit (cont'd.):
• If the entire list is searched in vain, then the job is
placed into a waiting queue.
• The Memory Manager then fetches the next job and
repeats the process.
Best-FitVersus First-Fit Allocation
(cont'd.)
Best-FitVersus First-Fit Allocation
(cont'd.)
• Algorithm for best-fit
• The goal is to find the smallest memory block into
which the job will fit
• The entire table must be searched before the
allocation can be made because the memory blocks
are physically stored in sequence according to their
location in memory.
Best-FitVersus First-Fit Allocation
(cont'd.)
Best-FitVersus First-Fit Allocation
(cont'd.)
• Hypothetical allocation schemes
• Next-fit:
• Starts searching from last allocated block, for next
available block when a new job arrives
• Worst-fit:
• Allocates largest free available block to new job
• Opposite of best-fit
• Good way to explore theory of memory allocation
• Not best choice for an actual system
Deallocation
• There eventually comes a time when memory space must
be released or deallocated.
• For a fixed-partition system:
• When the job is completed, the Memory Manager
resets the status of the memory block where the job
was stored to “free”.
• Any code may be used.
• Example code: binary values with zero indicating
free and one indicating busy.
Deallocation (cont'd.)
• For dynamic-partition system:
• A more complexAlgorithm is used because the algorithm
tries to combine free areas of memory whenever possible.
• The system must be prepared for three alternative
solutions:
• Case 1:When the block to be deallocated is adjacent
to another free block
• Case 2:When the block to be deallocated is between
two free blocks
• Case 3:When the block to be deallocated is isolated
from other free blocks
THANKYOU
Understanding Operating Systems, Sixth Edition 28

More Related Content

What's hot

Memory management
Memory managementMemory management
Memory management
cpjcollege
 
process creation OS
process creation OSprocess creation OS
process creation OS
Kiran Kumar Thota
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
Priyanka bisht
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Dr. Loganathan R
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
ManishaJha43
 
Memory management early_systems
Memory management early_systemsMemory management early_systems
Memory management early_systems
Mybej Che
 
Process of operating system
Process of operating systemProcess of operating system
Fragmentaton
Fragmentaton Fragmentaton
Fragmentaton
sanjana mun
 
Process management
Process managementProcess management
Process management
Birju Tank
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
Arnav Chowdhury
 
Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
meet darji
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
Wayne Jones Jnr
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
Amin Omi
 
Distributed Operating Systems
Distributed Operating SystemsDistributed Operating Systems
Distributed Operating Systems
Ummiya Mohammedi
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
Anamika Singh
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
Shashank Kapoor
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
Damian T. Gordon
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Luis Goldster
 

What's hot (20)

Memory management
Memory managementMemory management
Memory management
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
Memory management early_systems
Memory management early_systemsMemory management early_systems
Memory management early_systems
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Fragmentaton
Fragmentaton Fragmentaton
Fragmentaton
 
Process management
Process managementProcess management
Process management
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
Distributed Operating Systems
Distributed Operating SystemsDistributed Operating Systems
Distributed Operating Systems
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 

Similar to Memory Management

Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
Bullz Musetsho
 
Memory Management Strategies - II.pdf
Memory Management Strategies - II.pdfMemory Management Strategies - II.pdf
Memory Management Strategies - II.pdf
Harika Pudugosula
 
M20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptxM20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptx
HarikishnaKNHk
 
memory managment on computer science.ppt
memory managment on computer science.pptmemory managment on computer science.ppt
memory managment on computer science.ppt
footydigarse
 
7. Memory management in operating system.ppt
7. Memory management in operating system.ppt7. Memory management in operating system.ppt
7. Memory management in operating system.ppt
imrank39199
 
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
 
07-MemoryManagement.ppt
07-MemoryManagement.ppt07-MemoryManagement.ppt
07-MemoryManagement.ppt
hello509579
 
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
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
ssuser000e54
 
Memory Management
Memory ManagementMemory Management
Memory Management
DEDE IRYAWAN
 
OS UNIT4.pptx
OS UNIT4.pptxOS UNIT4.pptx
OS UNIT4.pptx
DHANABALSUBRAMANIAN
 
Chapter07_ds.ppt
Chapter07_ds.pptChapter07_ds.ppt
Chapter07_ds.ppt
AvadhRakholiya3
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
SandhyaTatekalva
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
Amanuelmergia
 
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
Peter Tröger
 
Stack and heap
Stack and heapStack and heap
Internet of Things, TYBSC IT, Semester 5, Unit IV
Internet of Things, TYBSC IT, Semester 5, Unit IVInternet of Things, TYBSC IT, Semester 5, Unit IV
Internet of Things, TYBSC IT, Semester 5, Unit IV
Arti Parab Academics
 
Operating systems- Main Memory Management
Operating systems- Main Memory ManagementOperating systems- Main Memory Management
Operating systems- Main Memory Management
Chandrakant Divate
 
Storage management
Storage managementStorage management
Storage management
Atul Sharma
 
Heap Memory Management.pptx
Heap Memory Management.pptxHeap Memory Management.pptx
Heap Memory Management.pptx
Viji B
 

Similar to Memory Management (20)

Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Memory Management Strategies - II.pdf
Memory Management Strategies - II.pdfMemory Management Strategies - II.pdf
Memory Management Strategies - II.pdf
 
M20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptxM20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptx
 
memory managment on computer science.ppt
memory managment on computer science.pptmemory managment on computer science.ppt
memory managment on computer science.ppt
 
7. Memory management in operating system.ppt
7. Memory management in operating system.ppt7. Memory management in operating system.ppt
7. Memory management in operating system.ppt
 
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
 
07-MemoryManagement.ppt
07-MemoryManagement.ppt07-MemoryManagement.ppt
07-MemoryManagement.ppt
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
OS UNIT4.pptx
OS UNIT4.pptxOS UNIT4.pptx
OS UNIT4.pptx
 
Chapter07_ds.ppt
Chapter07_ds.pptChapter07_ds.ppt
Chapter07_ds.ppt
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
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
 
Stack and heap
Stack and heapStack and heap
Stack and heap
 
Internet of Things, TYBSC IT, Semester 5, Unit IV
Internet of Things, TYBSC IT, Semester 5, Unit IVInternet of Things, TYBSC IT, Semester 5, Unit IV
Internet of Things, TYBSC IT, Semester 5, Unit IV
 
Operating systems- Main Memory Management
Operating systems- Main Memory ManagementOperating systems- Main Memory Management
Operating systems- Main Memory Management
 
Storage management
Storage managementStorage management
Storage management
 
Heap Memory Management.pptx
Heap Memory Management.pptxHeap Memory Management.pptx
Heap Memory Management.pptx
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 

Memory Management

  • 2. Introduction • Management of main memory is critical. • The performance of the entire system has been directly dependent on two things: • How much memory is available • How it is optimization while jobs are being processed. • This chapter introduces: • The memory manager (RAM) • Core memory (primary storage)
  • 3. Introduction • This chapter introduces: • Four types of memory allocation schemes • Single-user systems • Fixed partitions • Dynamic partitions • Relocatable dynamic partitions • These early memory management schemes are seldom used by today’s OSs but are important to study because each one introduced fundamental concepts that helped memory management evolve.
  • 4. Single-User Contiguous Scheme • Commercially available in 1940s and 1950s • Each program was loaded in its entirety into memory and allocated as much contiguous memory space allocated as it needed. • If the program was too large and didn’t fit the available memory space, it couldn’t be executed, • Although early computers were physically large, they had very little memory. • Computers have only a finite amount of memory.
  • 5. Single-User Contiguous Scheme • If a program doesn’t fit, then either the size of the main memory must be increased or the program must be modified. • Making it smaller • Using methods that allow program segments (partitions made to the program) to be overlaid. • Transfer segments of a program from secondary storage into main memory for execution • Two or more segments take turns occupying the same memory locations.
  • 6. Memory Management Concurrency • A program cannot process data it does not have. • A program spends more time waiting for I/O than processing data.
  • 7. Single-User Contiguous Scheme • The amount of work performed by the Memory Manager is minimal. • Only two hardware items are needed: • A register to store the base address • An accumulator to keep track of the size of the program as it’s being read into memory. • Once the program is entirely loaded into memory, it remains there until execution is complete, either through normal termination or by intervention of the OS.
  • 8. Single-User Contiguous Scheme (cont'd.) • Disadvantages • There is no support for multiprogramming or networking • It can handle only one job at a time. • This configuration was first used in research institutions but proved unacceptable for the business community. • It was not cost effective to spend almost $200,000 for equipment that could be used by only one person ay a time.
  • 9. Fixed Partitions • The first attempt to follow multiprogramming used fixed partitions (static partitions) within main memory. • One partition for each job. • The size of each partition was designated when the system was powered on. • Each partition could only be reconfigured when the system was shut down. • Once the system was in operation, the partition sizes remained static.
  • 10. Fixed Partitions • Introduced protection of the job’s memory space • Once a partition was assigned to a job, no other job could be allowed to enter its boundaries, either accidentally or intentionally. • Not a problem in single-user contiguous allocation schemes. • Fixed Partitions is more flexible than the Single-User scheme because it allows several programs to be in memory at the same time. • Fixed Partitions still requires that the entire program be stored contiguously and in memory from the beginning to the end of its execution.
  • 11. Fixed Partitions • In order to allocate memory spaces to jobs, the OS’s Memory Manager must keep a table which shows: • Each memory partition size • Its address • Its access restrictions • Its current status (free or busy) • As each job terminates, the status of its memory partition is changed from busy to free so an incoming job can be assigned to that partition.
  • 12. Fixed Partitions (cont'd.) • Disadvantages • The Fixed Partition scheme works well if all the jobs run on the system are of the same size or if the sizes are known ahead of time and don’t vary between reconfiguration. • If the partition sizes are too small: • larger jobs will be rejected if they’re too big to fit into the largest partition. • Large jobs will wait if the large partitions are busy. • Large jobs may have a longer turnaround time as they wait for free partitions of sufficient size or may never run.
  • 13. Fixed Partitions (cont'd.) • Disadvantages • If the partition sizes are too big, memory is wasted. • If a job does not occupy the entire partition, the unused memory in the partition will remain idle. • It can’t be given to another job because each partition is allocated to only one job at a time. • Partial usage of fixed partitions and the coinciding creation of unused spaces within the partition is called internal fragmentation and is a major drawback to the fixed partition memory allocation scheme.
  • 14. Dynamic Partitions • With Dynamic Partitions available memory is still kept in contiguous blocks but jobs are given only as much memory as they request when they are loaded for processing. • A dynamic partition scheme fully utilizes memory when the first jobs are loaded. • As new jobs enter the system that are not the same size as those that just vacated memory, they are fit into the available spaces on a priority basis. • First Come – First Serve priority
  • 15. Dynamic Partitions • The subsequent allocation of memory creates fragments of free memory between blocks of allocated memory. • External fragmentation • Lets memory go to waste
  • 17. Best-FitVersus First-Fit Allocation • For both fixed and dynamic memory allocation schemes, the OS must keep lists of each memory location noting which are free and which are busy. • As new jobs come into the system, the free partitions must be allocated. • These partitions may be allocated on the basis of: • First-fit memory allocation: • First partition fitting the requirements • Best-fit memory allocation: • Smallest partition fitting the requirements • Least wasted space
  • 20. Best-FitVersus First-Fit Allocation (cont'd.) • Algorithm for first-fit • Assumes memory manager keeps two lists • One for free memory blocks • One for busy memory blocks • The operation consists of a simple loop that compares the size of each job to the size of each memory block until a block is found that is large enough to fit the job. • The job is stored into that block of memory and the Memory Manager moves out of the loop to fetch the next job from the entry queue
  • 21. Best-FitVersus First-Fit Allocation (cont'd.) • Algorithm for first-fit (cont'd.): • If the entire list is searched in vain, then the job is placed into a waiting queue. • The Memory Manager then fetches the next job and repeats the process.
  • 23. Best-FitVersus First-Fit Allocation (cont'd.) • Algorithm for best-fit • The goal is to find the smallest memory block into which the job will fit • The entire table must be searched before the allocation can be made because the memory blocks are physically stored in sequence according to their location in memory.
  • 25. Best-FitVersus First-Fit Allocation (cont'd.) • Hypothetical allocation schemes • Next-fit: • Starts searching from last allocated block, for next available block when a new job arrives • Worst-fit: • Allocates largest free available block to new job • Opposite of best-fit • Good way to explore theory of memory allocation • Not best choice for an actual system
  • 26. Deallocation • There eventually comes a time when memory space must be released or deallocated. • For a fixed-partition system: • When the job is completed, the Memory Manager resets the status of the memory block where the job was stored to “free”. • Any code may be used. • Example code: binary values with zero indicating free and one indicating busy.
  • 27. Deallocation (cont'd.) • For dynamic-partition system: • A more complexAlgorithm is used because the algorithm tries to combine free areas of memory whenever possible. • The system must be prepared for three alternative solutions: • Case 1:When the block to be deallocated is adjacent to another free block • Case 2:When the block to be deallocated is between two free blocks • Case 3:When the block to be deallocated is isolated from other free blocks