Fragmentation in operating system is an important concept with the focus on making an efficient utilisation of computer available space. With fragmentation we have to divide a computer file into an executable program file which is then stored in different parts of the computer in fragments. In this blog, we are going to learn more about fragmentation and its importance in operating systems.
Fragmentation DefinitionÂ
Fragmentation is an important process in an operating system which divides its available space into multiple fragments stored in a non-contiguous manner. Fragmentation is an undesired function which occurs in the operating system when the process loading and unloading take place.
In fragmentation multiple storage space are utilised to store a part of memory in non contiguous blocks which make it difficult to allocate large contiguous spaces to process.Â
Fragmentation Key Takeaways
- Fragmentation is an undesired process occurring in the operating system.
- There are two major types of fragmentation i,e. External Fragmentation and Internal Fragmentation.
- Fragmentation can create an overload and occur when the allocated memory and available memory is not sufficient.
Types of Fragmentation in Operating System
There are two major types of fragmentation in operating systems as mentioned below.
External Fragmentation
- It occurs when free memory is available but scattered in small non-contiguous blocks.
- It prevents large processes from being allocated sufficient space despite enough total free memory.
- A simple example: A process of 10MB cannot be allocated if free memory consists of multiple smaller chunks (e.g., 5MB + 3MB + 2MB).
- To solve this process issue we need compaction (rearranging memory to create larger contiguous spaces).
Read More: What is Process Management In Operating System? Complete Explanation
Internal Fragmentation:
- This process happens when allocated memory is slightly larger than required, causing unused space within allocated blocks.
- Example: A process requiring 12 KB is given a 16KB block, wasting 4KB.
- A simple solution for this paging or dynamic memory allocation techniques like Buddy System.
Roles of Fragmentation in Operating System
Fragmentation in the operating system plays a major role in the performance of an operating system and the major impact of the fragmentation is slowing down the read due to the increased access time as all data is scattered to different zones in the computer.Â
This leads to a major impact on the performance of a computer system as it slows down the application as more and more space is occupied at the moment. It is important to defragment the disk in the operating system and make it contagious to allow efficient storage spacing and access methods. It will not only improve the read time but also reduce the access time and overall speed of the application.
Read More: Important Topics for Freshers In Operating System
How to Solve Fragmentation In Operating Systems?
Fragmentation occurs in an operating system when the available memory space is utilised insignificantly. Let us know how to solve external or internal fragmentation easily. These methods can be used to solve external fragmentation in the operating system.
1. Memory FragmentationÂ
- This method moves all occupied memory blocks together to create a single large free block.
- It also helps in allocating larger processes. However, this can create an overhead for the memory allocation process.Â
Read More: Memory Management in Operating System in 2025
2. Paging
- Paging divides both physical memory and processes into fixed-size blocks called pages (process side) and frames (memory side).
- It can help eliminate external fragmentation since pages can be placed anywhere in memory.
- It might lead to internal fragmentation if page size is too large.
3. SegmentationÂ
- It divides memory into variable-sized segments based on logical program structure (e.g., code, stack, heap).
- It also reduces fragmentation but can still lead to external fragmentation if segments are too large.
- It can be combined with paging (segmented paging) for better efficiency.
4. Paging with Virtual Memory
- It uses virtual memory to store parts of a process in the disk which reduces the need for contiguous physical memory.
- It allows processes to execute even if they are not fully loaded into the RAM.
Now, let us get an insight on how to solve internal fragmentation when the allocated memory space is larger than required which leads to wastage of useful space.Â
5. Buddy System
- It divides memory into power-of-two blocks.
- If a process needs 18KB, it gets a 32 KB block (smallest power of 2 that fits).
- When a process finishes, memory is merged back into larger blocks to reduce fragmentation.
6. Slab Allocation
- It pre allocates fixed-sized memory blocks (slabs) for similar-sized objects.
- It is an ideal method for kernel memory allocation (used in Linux).
- It also help to prevent excessive memory wastage.
7. Best Fit Memory Allocation
- It allocates the smallest free block that can fit the process.
- It also reduces internal fragmentation compared to first fit or worst fit strategies.
What Are the Impacts on Fragmentation in Operating Systems?
Fragmentation in operating system can have a huge impact on the performance and storage of the data in the available space in an operating system.Â
- External fragmentation leaves small, unusable memory gaps that cannot be assigned to large processes.
- Internal fragmentation wastes allocated memory, leading to inefficient resource use.
- Frequent memory allocation and deallocation cause fragmentation, slowing down system performance.
- The OS may spend extra time searching for suitable memory blocks, increasing processing overhead.
- Techniques like compaction require CPU cycles to rearrange memory blocks, reducing available processing power for applications.
- Paging and segmentation require additional calculations, impacting system responsiveness.
- Due to external fragmentation, a process may not get contiguous memory space even if enough free memory is available.
- It leads to process starvation or system crashes in severe cases.
- When RAM is fragmented, virtual memory (swap space) is used more frequently, increasing disk I/O operations.
- Slower performance due to excessive page swapping between RAM and disk.
- Fixed-size memory allocation (e.g., paging) may assign more memory than required, causing small memory chunks to remain unused
- Large-scale inefficiencies in systems handling multiple small processes.
- Severe fragmentation can prevent critical system processes from running properly.
- It leads to unexpected crashes, hangs, or sluggish system behavior.
Become a DevOps Expert with PW Skills
Discover a wide range of career opportunities in DevOps and Cloud Computing with the PW Skills DevOps and Cloud Computing Course and master in-demand tools like Ansible, Kubernetes, Jenkins, and more with our interactive coursework, dedicated mentors and more. Get real-world projects, practice exercises, module assignments to help you strengthen everything you learnt throughout the course.
Hurry! Enroll in this course and start your learning journey. Become a certified devOps engineer with pwskills.comÂ
Fragmentation in Operating System FAQs
Q1. What is fragmentation in operating system?
Ans: Fragmentation is an undesired function which occurs in the operating system when the process loading and unloading take place.
Q2. How many types of fragmentation occur in operating system?
Ans: Fragmentation in operating systems are of two types i,e. External fragmentation and internal fragmentation.
Q3. What are the drawbacks of fragmentation in operating system?
Ans: Fragmentation in operating system can lead to slowing of the CPU space due to insufficient storage. A longer access time is needed to search or access the fragmented files. It can make organisation of files difficult and more.
Q4. What is external fragmentation?
Ans: External fragmentation occurs when free memory is available but scattered in small non-contiguous blocks. It prevents large processes from being allocated sufficient space despite enough total free memory.