SlideShare a Scribd company logo
1 of 17
KERNEL MEMORY ALLOCATION,
REVIEW OF RELOCATION,
PROGRAM FORMS
Roopak Bhama
(MCA/25003/18)
BIRLA INSTITUTE OF TECHNOLOGY
MESRA, JAIPUR CAMPUS
WHAT IS KERNEL
• A kernel is actually a large block of code which keeps
the system up and running from the time of booting,
till shutdown.
• It is responsible for managing and allocating resources
like memory, processors etc.
• It also allows OS to communicate and control various
external hardware devices like pen drive, memory card,
keyboard etc.
MICRO KERNEL
• Mostly used by OS.
• It manages all system
resources.
• User Services and Kernel
Services are implemented in
different address space.
• The kernel program runs in
another memory area called
“kernel space”.
• Kernel programming means
power to access anything
and everything in a system.
MONOLITHIC KERNEL
MICRO KERNEL VS MONOLITHIC
KERNEL
USER PROGRAM
• User program or
applications runs in a
memory area called “user
space”.
• Cannot access kernel space
directly, so system calls are
made which acts as software
interrupts.
• The kernel program runs in
another memory area called
“kernel space”.
• Kernel programming means
power to access anything
and everything in a system,
called supper access mode.
KERNEL PROGRAM
USER PROGRAM VS KERNEL
PROGRAM
DIFFERENCE BETWEEN KERNEL
AND USER PROGRAM
• Execution Differences
• Kernel modules have separate address space.
• Kernel modules have higher execution privilege.
• Kernel modules do not execute sequentially
• Structural Differences
• Kernel modules do not define a main program.
• instead of main(), looks for open() as it’s a software interface
for I/O
• Kernel modules use different header files.
• Kernel modules can be customized for hardware.
ALLOCATING KERNEL MEMORY
• Unix divides memory into fixed size of continuous block
of virtual memory page.
• Page size is a power of two – typical size is 4 Kbytes.
• It is treated differently from user memory.
• Kernel request memory of different structures of variable
sizes
• minimize waste due to fragmentation
• Two strategies are used for memory managing
• Buddy System
• Slab System
THE BUDDY SYSTEM
• Buddy allocation system is an algorithm in which a
larger memory block is divided into small parts to
satisfy the request. Each equal half of a split buffer is
called a buddy.
• In the same manner one of the two buddies will
further divide into smaller parts until the request is
fulfilled.
THE BUDDY SYSTEM
• Advantages – flexible – allows to use buffers of different
sizes, easy exchange of memory between the allocator
and the paging system.
• Disadvantage - poor performance, inconvenient
programming interface, impossible to release a part of a
buffer.
THE BINARY BUDDY SYSTEM
• The buddy system maintains a list of the free blocks of
each size (called a free list), so that it is easy to find a
block of the desired size, if one is available.
• It provides storage in block sizes which are powers of
2, from a pool of available memory space of size 2k.
• When a block of size 2k is requested, the available
space list is examined. If a block of the proper size is
available, it is used. Otherwise, an iterative request for
a block of size 2k+1 is made.
• The effectiveness is determined by measuring two
types of losses in storage utilization: internal memory
fragmentation and external memory fragmentation.
THE BINARY BUDDY SYSTEM
• Internal fragmentation is the
result of allocating only blocks
of predetermined sizes, so
that a request for memory
must be rounded up to the
next larger block size.
• External fragmentation is
the result of breaking down
memory into separate blocks
which cannot be combined
into a desired larger block.
WEIGHTED BUDDY SYSTEM
• The differences between binary and weighted methods
lie in how the blocks are split, the mechanism of
address calculation.
• In Binary, 2k is followed while creating memory blocks
but in Weighted, 3*2k is followed.
• A block of size 2k+2 is split into two blocks of sizes
3*2k and 2k. Blocks of size 3*2k are split into sizes and
2k.
• Blocks split from the same parent block are called
buddies. Since the buddies of a pair have different
sizes, they are called weighted buddies.
WEIGHTED BUDDY SYSTEM
FIBONACCI BUDDY SYSTEM
• This is the system in which blocks are divided into sizes
which are Fibonacci numbers.
• 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 144, 233, 377, 610.
• Advantages
• Memory Allocation is implemented using binary tree.
• Fast to allocate and deallocate.
• Cost to allocate and deallocate memory is low.
• Easy address calculation
• Coalescing – Defined as how quickly adjacent buddies can be
combined to form larger segments.
SLAB ALLOCATION
• In slab allocation memory chunks suitable to fit data
objects of certain type or size are pre allocated. Cache
does not free the space immediately. Two terms
required are:
• Slab
• made up of one or more physically contiguous pages.
• The slab is the actual container of data
• Cache
• represents a small amount of very fast memory.
• A cache consists of one or more slabs. There is a single
cache for each unique kernel data structure.
SLAB ALLOCATION
IMPLEMENTING SLAB
ALLOCATION
• The slab allocation algorithm uses caches to store
kernel objects. When a cache is created a number of
objects which are initially marked as free are allocated
to the cache.
• When a new object for a kernel data structure is
needed, the allocator can assign any free object from
the cache to satisfy the request. The object assigned
from the cache is marked as used.
• In Linux, a slab may in one of three possible states:
• Full – All objects in the slab are marked as used
• Empty – All objects in the slab are marked as free
• Partial – The slab consists of both
REFERENCES
• www.cosc.brocku.ca/Offerings/4P13/slides/kma.ppt
• https://www.geeksforgeeks.org/operating-system-
allocating-kernel-memory-buddy-system-slab-system/
• https://www.quora.com/What-is-the-difference-
between-user-space-and-the-kernel-space
• http://jklp.org/profession/papers/wbuddy/paper.html

More Related Content

What's hot

Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer ScienceTransweb Global Inc
 
31 address binding, dynamic loading
31 address binding, dynamic loading31 address binding, dynamic loading
31 address binding, dynamic loadingmyrajendra
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
Operating Systems: Device Management
Operating Systems: Device ManagementOperating Systems: Device Management
Operating Systems: Device ManagementDamian T. Gordon
 
Storage management
Storage managementStorage management
Storage managementAtul Sharma
 
Memory management
Memory managementMemory management
Memory managementPATELARCH
 
Memory management
Memory managementMemory management
Memory managementSlideshare
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management Maitree Patel
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memorymyrajendra
 
Give or take a block
Give or take a blockGive or take a block
Give or take a blockTomer Perry
 

What's hot (20)

Chapter 20
Chapter 20Chapter 20
Chapter 20
 
Memory management
Memory managementMemory management
Memory management
 
Module5 secondary storage
Module5 secondary storageModule5 secondary storage
Module5 secondary storage
 
Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
 
31 address binding, dynamic loading
31 address binding, dynamic loading31 address binding, dynamic loading
31 address binding, dynamic loading
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Operating Systems: Device Management
Operating Systems: Device ManagementOperating Systems: Device Management
Operating Systems: Device Management
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Storage management
Storage managementStorage management
Storage management
 
Memory management
Memory managementMemory management
Memory management
 
Memory management OS
Memory management OSMemory management OS
Memory management OS
 
Memory management
Memory managementMemory management
Memory management
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Memory managment
Memory managmentMemory managment
Memory managment
 
In a monolithic kernel
In a monolithic kernelIn a monolithic kernel
In a monolithic kernel
 
39 virtual memory
39 virtual memory39 virtual memory
39 virtual memory
 
Memory
MemoryMemory
Memory
 
Give or take a block
Give or take a blockGive or take a block
Give or take a block
 

Similar to Kernel Memory Allocation and Management Techniques

Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory managementVandana Salve
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris MasonTerry Wang
 
Linux operating system
Linux operating systemLinux operating system
Linux operating systemITz_1
 
Ct213 memory subsystem
Ct213 memory subsystemCt213 memory subsystem
Ct213 memory subsystemSandeep Kamath
 
Computer organization memory hierarchy
Computer organization memory hierarchyComputer organization memory hierarchy
Computer organization memory hierarchyAJAL A J
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Managing Memory Allocation
Managing Memory AllocationManaging Memory Allocation
Managing Memory AllocationMeghaj Mallick
 
Memory allocation for real time operating system
Memory allocation for real time operating systemMemory allocation for real time operating system
Memory allocation for real time operating systemAsma'a Lafi
 
coa-Unit5-ppt1 (1).pptx
coa-Unit5-ppt1 (1).pptxcoa-Unit5-ppt1 (1).pptx
coa-Unit5-ppt1 (1).pptxRuhul Amin
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache designRohail Butt
 
Memory Management
Memory ManagementMemory Management
Memory ManagementSanthiNivas
 
Amazon elastic block store (ebs) and
Amazon elastic block store (ebs) andAmazon elastic block store (ebs) and
Amazon elastic block store (ebs) andlurdhu agnes
 
Application Performance & Flexibility on Exokernel Systems paper review
Application Performance & Flexibility on Exokernel Systems paper reviewApplication Performance & Flexibility on Exokernel Systems paper review
Application Performance & Flexibility on Exokernel Systems paper reviewVimukthi Wickramasinghe
 
M20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptxM20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptxHarikishnaKNHk
 

Similar to Kernel Memory Allocation and Management Techniques (20)

kerch04.ppt
kerch04.pptkerch04.ppt
kerch04.ppt
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
 
UNIT IV.pptx
UNIT IV.pptxUNIT IV.pptx
UNIT IV.pptx
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Memory (Computer Organization)
Memory (Computer Organization)Memory (Computer Organization)
Memory (Computer Organization)
 
Btrfs by Chris Mason
Btrfs by Chris MasonBtrfs by Chris Mason
Btrfs by Chris Mason
 
Linux operating system
Linux operating systemLinux operating system
Linux operating system
 
Ct213 memory subsystem
Ct213 memory subsystemCt213 memory subsystem
Ct213 memory subsystem
 
Computer organization memory hierarchy
Computer organization memory hierarchyComputer organization memory hierarchy
Computer organization memory hierarchy
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Os
OsOs
Os
 
OS UNIT4.pptx
OS UNIT4.pptxOS UNIT4.pptx
OS UNIT4.pptx
 
Managing Memory Allocation
Managing Memory AllocationManaging Memory Allocation
Managing Memory Allocation
 
Memory allocation for real time operating system
Memory allocation for real time operating systemMemory allocation for real time operating system
Memory allocation for real time operating system
 
coa-Unit5-ppt1 (1).pptx
coa-Unit5-ppt1 (1).pptxcoa-Unit5-ppt1 (1).pptx
coa-Unit5-ppt1 (1).pptx
 
Elements of cache design
Elements of cache designElements of cache design
Elements of cache design
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Amazon elastic block store (ebs) and
Amazon elastic block store (ebs) andAmazon elastic block store (ebs) and
Amazon elastic block store (ebs) and
 
Application Performance & Flexibility on Exokernel Systems paper review
Application Performance & Flexibility on Exokernel Systems paper reviewApplication Performance & Flexibility on Exokernel Systems paper review
Application Performance & Flexibility on Exokernel Systems paper review
 
M20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptxM20CA1030_391_2_Part2.pptx
M20CA1030_391_2_Part2.pptx
 

More from Meghaj Mallick

PORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSPORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSMeghaj Mallick
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software TestingMeghaj Mallick
 
Introduction to System Programming
Introduction to System ProgrammingIntroduction to System Programming
Introduction to System ProgrammingMeghaj Mallick
 
Icons, Image & Multimedia
Icons, Image & MultimediaIcons, Image & Multimedia
Icons, Image & MultimediaMeghaj Mallick
 
Project Tracking & SPC
Project Tracking & SPCProject Tracking & SPC
Project Tracking & SPCMeghaj Mallick
 
Architecture and security in Vanet PPT
Architecture and security in Vanet PPTArchitecture and security in Vanet PPT
Architecture and security in Vanet PPTMeghaj Mallick
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringMeghaj Mallick
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningMeghaj Mallick
 
DFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmDFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmMeghaj Mallick
 
Software Development Method
Software Development MethodSoftware Development Method
Software Development MethodMeghaj Mallick
 
Secant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodSecant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodMeghaj Mallick
 
Motivation in Organization
Motivation in OrganizationMotivation in Organization
Motivation in OrganizationMeghaj Mallick
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete MathematicsMeghaj Mallick
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure Meghaj Mallick
 

More from Meghaj Mallick (20)

24 partial-orderings
24 partial-orderings24 partial-orderings
24 partial-orderings
 
PORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSPORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSS
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
 
Introduction to System Programming
Introduction to System ProgrammingIntroduction to System Programming
Introduction to System Programming
 
MACRO ASSEBLER
MACRO ASSEBLERMACRO ASSEBLER
MACRO ASSEBLER
 
Icons, Image & Multimedia
Icons, Image & MultimediaIcons, Image & Multimedia
Icons, Image & Multimedia
 
Project Tracking & SPC
Project Tracking & SPCProject Tracking & SPC
Project Tracking & SPC
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
 
Routing in MANET
Routing in MANETRouting in MANET
Routing in MANET
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
 
Architecture and security in Vanet PPT
Architecture and security in Vanet PPTArchitecture and security in Vanet PPT
Architecture and security in Vanet PPT
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data Mining
 
DFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmDFS & BFS in Computer Algorithm
DFS & BFS in Computer Algorithm
 
Software Development Method
Software Development MethodSoftware Development Method
Software Development Method
 
Secant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodSecant method in Numerical & Statistical Method
Secant method in Numerical & Statistical Method
 
Motivation in Organization
Motivation in OrganizationMotivation in Organization
Motivation in Organization
 
Communication Skill
Communication SkillCommunication Skill
Communication Skill
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
 

Recently uploaded

Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMoumonDas2
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Chameera Dedduwage
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxNikitaBankoti2
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Salam Al-Karadaghi
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...Sheetaleventcompany
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesPooja Nehwal
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...NETWAYS
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )Pooja Nehwal
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfhenrik385807
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfhenrik385807
 
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrSaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrsaastr
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AITatiana Gurgel
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...henrik385807
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Kayode Fayemi
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024eCommerce Institute
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyPooja Nehwal
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxmohammadalnahdi22
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 

Recently uploaded (20)

Mathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptxMathematics of Finance Presentation.pptx
Mathematics of Finance Presentation.pptx
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
 
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
Exploring protein-protein interactions by Weak Affinity Chromatography (WAC) ...
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
 
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdfCTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
CTAC 2024 Valencia - Henrik Hanke - Reduce to the max - slideshare.pdf
 
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStrSaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
SaaStr Workshop Wednesday w: Jason Lemkin, SaaStr
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
Microsoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AIMicrosoft Copilot AI for Everyone - created by AI
Microsoft Copilot AI for Everyone - created by AI
 
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Vaishnavi 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Vaishnavi 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
CTAC 2024 Valencia - Sven Zoelle - Most Crucial Invest to Digitalisation_slid...
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptxMohammad_Alnahdi_Oral_Presentation_Assignment.pptx
Mohammad_Alnahdi_Oral_Presentation_Assignment.pptx
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 

Kernel Memory Allocation and Management Techniques

  • 1. KERNEL MEMORY ALLOCATION, REVIEW OF RELOCATION, PROGRAM FORMS Roopak Bhama (MCA/25003/18) BIRLA INSTITUTE OF TECHNOLOGY MESRA, JAIPUR CAMPUS
  • 2. WHAT IS KERNEL • A kernel is actually a large block of code which keeps the system up and running from the time of booting, till shutdown. • It is responsible for managing and allocating resources like memory, processors etc. • It also allows OS to communicate and control various external hardware devices like pen drive, memory card, keyboard etc.
  • 3. MICRO KERNEL • Mostly used by OS. • It manages all system resources. • User Services and Kernel Services are implemented in different address space. • The kernel program runs in another memory area called “kernel space”. • Kernel programming means power to access anything and everything in a system. MONOLITHIC KERNEL MICRO KERNEL VS MONOLITHIC KERNEL
  • 4. USER PROGRAM • User program or applications runs in a memory area called “user space”. • Cannot access kernel space directly, so system calls are made which acts as software interrupts. • The kernel program runs in another memory area called “kernel space”. • Kernel programming means power to access anything and everything in a system, called supper access mode. KERNEL PROGRAM USER PROGRAM VS KERNEL PROGRAM
  • 5. DIFFERENCE BETWEEN KERNEL AND USER PROGRAM • Execution Differences • Kernel modules have separate address space. • Kernel modules have higher execution privilege. • Kernel modules do not execute sequentially • Structural Differences • Kernel modules do not define a main program. • instead of main(), looks for open() as it’s a software interface for I/O • Kernel modules use different header files. • Kernel modules can be customized for hardware.
  • 6. ALLOCATING KERNEL MEMORY • Unix divides memory into fixed size of continuous block of virtual memory page. • Page size is a power of two – typical size is 4 Kbytes. • It is treated differently from user memory. • Kernel request memory of different structures of variable sizes • minimize waste due to fragmentation • Two strategies are used for memory managing • Buddy System • Slab System
  • 7. THE BUDDY SYSTEM • Buddy allocation system is an algorithm in which a larger memory block is divided into small parts to satisfy the request. Each equal half of a split buffer is called a buddy. • In the same manner one of the two buddies will further divide into smaller parts until the request is fulfilled.
  • 8. THE BUDDY SYSTEM • Advantages – flexible – allows to use buffers of different sizes, easy exchange of memory between the allocator and the paging system. • Disadvantage - poor performance, inconvenient programming interface, impossible to release a part of a buffer.
  • 9. THE BINARY BUDDY SYSTEM • The buddy system maintains a list of the free blocks of each size (called a free list), so that it is easy to find a block of the desired size, if one is available. • It provides storage in block sizes which are powers of 2, from a pool of available memory space of size 2k. • When a block of size 2k is requested, the available space list is examined. If a block of the proper size is available, it is used. Otherwise, an iterative request for a block of size 2k+1 is made. • The effectiveness is determined by measuring two types of losses in storage utilization: internal memory fragmentation and external memory fragmentation.
  • 10. THE BINARY BUDDY SYSTEM • Internal fragmentation is the result of allocating only blocks of predetermined sizes, so that a request for memory must be rounded up to the next larger block size. • External fragmentation is the result of breaking down memory into separate blocks which cannot be combined into a desired larger block.
  • 11. WEIGHTED BUDDY SYSTEM • The differences between binary and weighted methods lie in how the blocks are split, the mechanism of address calculation. • In Binary, 2k is followed while creating memory blocks but in Weighted, 3*2k is followed. • A block of size 2k+2 is split into two blocks of sizes 3*2k and 2k. Blocks of size 3*2k are split into sizes and 2k. • Blocks split from the same parent block are called buddies. Since the buddies of a pair have different sizes, they are called weighted buddies.
  • 13. FIBONACCI BUDDY SYSTEM • This is the system in which blocks are divided into sizes which are Fibonacci numbers. • 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 144, 233, 377, 610. • Advantages • Memory Allocation is implemented using binary tree. • Fast to allocate and deallocate. • Cost to allocate and deallocate memory is low. • Easy address calculation • Coalescing – Defined as how quickly adjacent buddies can be combined to form larger segments.
  • 14. SLAB ALLOCATION • In slab allocation memory chunks suitable to fit data objects of certain type or size are pre allocated. Cache does not free the space immediately. Two terms required are: • Slab • made up of one or more physically contiguous pages. • The slab is the actual container of data • Cache • represents a small amount of very fast memory. • A cache consists of one or more slabs. There is a single cache for each unique kernel data structure.
  • 16. IMPLEMENTING SLAB ALLOCATION • The slab allocation algorithm uses caches to store kernel objects. When a cache is created a number of objects which are initially marked as free are allocated to the cache. • When a new object for a kernel data structure is needed, the allocator can assign any free object from the cache to satisfy the request. The object assigned from the cache is marked as used. • In Linux, a slab may in one of three possible states: • Full – All objects in the slab are marked as used • Empty – All objects in the slab are marked as free • Partial – The slab consists of both
  • 17. REFERENCES • www.cosc.brocku.ca/Offerings/4P13/slides/kma.ppt • https://www.geeksforgeeks.org/operating-system- allocating-kernel-memory-buddy-system-slab-system/ • https://www.quora.com/What-is-the-difference- between-user-space-and-the-kernel-space • http://jklp.org/profession/papers/wbuddy/paper.html