SlideShare a Scribd company logo
1 of 10
Operatingsystem..
By:
Adithya M
BCA; 2nd sem
19NCBC1042
National college, basavanagudi
Topic: Compaction..
Compaction
Memory compaction is the process of moving
allocated objects together and leaving empty space
together.
It is a technique that is used when memory is divided into
variable-size partitions. Compaction refers to combining
all the empty spaces together and processes. By applying
this technique, we can store the bigger processes in the
memory. The free partitions are merged which can now be
allocated according to the needs of new processes.
Compaction is the process of moving memory around to
eliminate most of the smaller holes and make one larger hole. On
hole. On storage disks, this is known as disk defragmentation – a
a well used utility in mostWindows operating systems. Like
defragmentation, compaction is very time expensive. It is possible
possible to perform a partial compaction, simply to create a hole in
in memory large enough to house the new process that is
attempting to execute. i.e. compaction is a method to overcome the
the external fragmentation problem.
What is compaction ??
The idea of compaction is to move all processes towards one end of memory and all the free blocks of memory towards
the other end. For example, consider the case in which the blocks are distributed between 2 processes as shown in the
below image.
Now, using the compaction algorithm, we move process P2 upwards and the free block of 100 K between P1 and P2
downwards thus forming a big block of 500 K. However, compaction is possible only when dynamic relocation is used
i.e. when the address binding is done at runtime.
Consider a system with 3 pages and about 50% of
their objects are allocated. By compacting, all the living
living objects are moved into the first two pages, leaving
leaving the second half of the second page and the third
third page completely empty.The empty page can then
then be ignored during future mark/sweep phases since
since it is known to be empty of living objects, or it can
can be released and returned to the desired operating
system.
Advantages of compactions
 In memory management, swapping creates multiple fragments in the
memory because of the processes moving in and out.
 Compaction helps to solve the problem of fragmentation, but it requires
too much of CPU time.
 It moves all the occupied areas of store to one end and leaves one large
free memory or space for incoming jobs in one large block, instead of
numerous small ones.
 In compaction, the system also maintains relocation information and it
must be performed on each new allocation of job to the memory or
completion of job from memory.
 Reduces external fragmentation. All free blocks are brought together as
one large block of free space.
Now imagine a storage “pool” managed by the
operating system. Processes then request from the OS to be
granted the use of storage fragments of various sizes, use
them, and then “free” them when done. This all happens in a
generally random fashion. Over time, storage in the pool will
tend to become fragmented, meaning that the segments
that are in use and those that are free will be scattered all
through the pool. Now some process requests a large piece
of storage from the OS, and the OS cannot satisfy that
request because, although the total amount of free/unused
storage in the pool is large, there is no single contiguous
“piece” that is large enough to satisfy the request. At this
point, the OS has to compact the pool which means
reorganize the arrangement of the free and used areas by
moving them in real storage and updating the virtual storage
address lookup tables so that their virtual addresses remain
We got to know that the dynamic partitioning suffers from external
fragmentation. However, this can cause some serious problems.
To avoid compaction, we need to change the rule which says that the process
can't be stored in the different places in the memory.
We can also use compaction to minimize the probability of external
fragmentation. In compaction, all the free partitions are made contiguous and
all the loaded partitions are brought together.
By applying this technique, we can store the bigger processes in the memory.
The free partitions are merged which can now be allocated according to the
needs of new processes. This
technique is also called defragmentation.
As shown in the image, the process P5, which could not be loaded into the
memory due to the lack of contiguous space, can be loaded now in the
memory since the free partitions are made contiguous.
Problems/disadvantages of Compaction
 The efficiency of the system is decreased in the case of
compaction due to the fact that all the free spaces will be
transferred from several places to a single place.
 Huge amount of time is invested for this procedure and the
remain idle for all this time. Despite of the fact that the
avoids external fragmentation, it makes system inefficient.
 Large sized memory transfer needs some huge amount of
in seconds.
conviction in operating system

More Related Content

Similar to conviction in operating system

Analysis of Allocation Algorithms in Memory Management
Analysis of Allocation Algorithms in Memory ManagementAnalysis of Allocation Algorithms in Memory Management
Analysis of Allocation Algorithms in Memory Management
ijtsrd
 
Memory Managementgggffffffffffgggggggggg
Memory ManagementgggffffffffffggggggggggMemory Managementgggffffffffffgggggggggg
Memory Managementgggffffffffffgggggggggg
BHUPESHRAHANGDALE200
 

Similar to conviction in operating system (20)

Analysis of Allocation Algorithms in Memory Management
Analysis of Allocation Algorithms in Memory ManagementAnalysis of Allocation Algorithms in Memory Management
Analysis of Allocation Algorithms in Memory Management
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management
 
Memory Managementgggffffffffffgggggggggg
Memory ManagementgggffffffffffggggggggggMemory Managementgggffffffffffgggggggggg
Memory Managementgggffffffffffgggggggggg
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Fixed partitioning of memory
Fixed partitioning of memoryFixed partitioning of memory
Fixed partitioning of memory
 
local_media3192961381667787861026781.pptx
local_media3192961381667787861026781.pptxlocal_media3192961381667787861026781.pptx
local_media3192961381667787861026781.pptx
 
Virtual memory pre-final-formatting
Virtual memory pre-final-formattingVirtual memory pre-final-formatting
Virtual memory pre-final-formatting
 
Memory management
Memory managementMemory management
Memory management
 
Mca admissions in india
Mca admissions in indiaMca admissions in india
Mca admissions in india
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Management
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Module 4 memory management
Module 4 memory managementModule 4 memory management
Module 4 memory management
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 

conviction in operating system

  • 1. Operatingsystem.. By: Adithya M BCA; 2nd sem 19NCBC1042 National college, basavanagudi Topic: Compaction..
  • 2. Compaction Memory compaction is the process of moving allocated objects together and leaving empty space together. It is a technique that is used when memory is divided into variable-size partitions. Compaction refers to combining all the empty spaces together and processes. By applying this technique, we can store the bigger processes in the memory. The free partitions are merged which can now be allocated according to the needs of new processes.
  • 3. Compaction is the process of moving memory around to eliminate most of the smaller holes and make one larger hole. On hole. On storage disks, this is known as disk defragmentation – a a well used utility in mostWindows operating systems. Like defragmentation, compaction is very time expensive. It is possible possible to perform a partial compaction, simply to create a hole in in memory large enough to house the new process that is attempting to execute. i.e. compaction is a method to overcome the the external fragmentation problem. What is compaction ??
  • 4. The idea of compaction is to move all processes towards one end of memory and all the free blocks of memory towards the other end. For example, consider the case in which the blocks are distributed between 2 processes as shown in the below image. Now, using the compaction algorithm, we move process P2 upwards and the free block of 100 K between P1 and P2 downwards thus forming a big block of 500 K. However, compaction is possible only when dynamic relocation is used i.e. when the address binding is done at runtime.
  • 5. Consider a system with 3 pages and about 50% of their objects are allocated. By compacting, all the living living objects are moved into the first two pages, leaving leaving the second half of the second page and the third third page completely empty.The empty page can then then be ignored during future mark/sweep phases since since it is known to be empty of living objects, or it can can be released and returned to the desired operating system.
  • 6. Advantages of compactions  In memory management, swapping creates multiple fragments in the memory because of the processes moving in and out.  Compaction helps to solve the problem of fragmentation, but it requires too much of CPU time.  It moves all the occupied areas of store to one end and leaves one large free memory or space for incoming jobs in one large block, instead of numerous small ones.  In compaction, the system also maintains relocation information and it must be performed on each new allocation of job to the memory or completion of job from memory.  Reduces external fragmentation. All free blocks are brought together as one large block of free space.
  • 7. Now imagine a storage “pool” managed by the operating system. Processes then request from the OS to be granted the use of storage fragments of various sizes, use them, and then “free” them when done. This all happens in a generally random fashion. Over time, storage in the pool will tend to become fragmented, meaning that the segments that are in use and those that are free will be scattered all through the pool. Now some process requests a large piece of storage from the OS, and the OS cannot satisfy that request because, although the total amount of free/unused storage in the pool is large, there is no single contiguous “piece” that is large enough to satisfy the request. At this point, the OS has to compact the pool which means reorganize the arrangement of the free and used areas by moving them in real storage and updating the virtual storage address lookup tables so that their virtual addresses remain
  • 8. We got to know that the dynamic partitioning suffers from external fragmentation. However, this can cause some serious problems. To avoid compaction, we need to change the rule which says that the process can't be stored in the different places in the memory. We can also use compaction to minimize the probability of external fragmentation. In compaction, all the free partitions are made contiguous and all the loaded partitions are brought together. By applying this technique, we can store the bigger processes in the memory. The free partitions are merged which can now be allocated according to the needs of new processes. This technique is also called defragmentation. As shown in the image, the process P5, which could not be loaded into the memory due to the lack of contiguous space, can be loaded now in the memory since the free partitions are made contiguous.
  • 9. Problems/disadvantages of Compaction  The efficiency of the system is decreased in the case of compaction due to the fact that all the free spaces will be transferred from several places to a single place.  Huge amount of time is invested for this procedure and the remain idle for all this time. Despite of the fact that the avoids external fragmentation, it makes system inefficient.  Large sized memory transfer needs some huge amount of in seconds.