ADVERTISEMENT
ADVERTISEMENT

Home » Operating Systems

Fragmentation in Operating System

Fragmentation in operating system: In this tutorial, we are going to learn what is fragmentation, cause of fragmentation, types of fragmentation, etc.
Submitted by Monika Jha, on September 24, 2019

In a computer storage system, as processes are loaded and removed from memory, the free memory space is broken into small pieces. In this way memory space used inefficiently, so the capacity or performance of the system may degrade.

The conditions of the fragmentation depend on the system of memory allocation. In most of the cases, memory space is wasted.

Sometimes it happens that memory blocks cannot be allocated to processes due to their small size and memory blocks remain unused. This problem is known as Fragmentation.

Cause of fragmentation

User processes are loaded and removed from the main memory, processes are stored in the blocks of main memory. At the time of process loading and swapping there are many spaces left which are not capable to load any other process due to their size.

Due to the dynamical allocation of main memory processes, main memory is available but its space is not sufficient to load any other process.

Types of fragmentation

  1. External fragmentation
  2. Internal fragmentation
  3. Data fragmentation

1) External fragmentation

External fragmentation exists when adequate total memory space exists to satisfy a request, but it is not contiguous; storage is fragmented into a large number of holes.

External fragmentation in OS


2) Internal fragmentation

An approach is to allocate very small holes as part of the larger request. Thus the allocated memory may be larger than the requested memory.

The difference between these two numbers is internal fragmentation - the memory that is internal to any partition but is not being used.

Internal fragmentation in OS

There is a hole of 500k. Suppose that next process request 450k. If we allocate the requested block, so there is a hole left which is 50k. This type of condition raises internal fragmentation.

3) Data fragmentation

This type of fragmentation occurs when a group of data in memory is broken up into many pieces that are not contiguous that is not close together.

If we are attempting to insert a large object into memory that has already suffered then external fragmentation occurs.

Example:

In a file system files are arranged in units called clustersblocks. There is a free space to store files in these blocks in a contiguous manner.

In this way, we can do a rapid sequential file reads and writes. As files are added, deleted, and modified or changed in size, there are external fragmentation occurs, and there are only small holes in which we can place new data.

when a current file is enlarged, the operating system places the new data a in new non-contiguous data blocks to fit into the available holes. New data blocks don't need to be contiguous. This process slowing access cause of seek time and rotational latency of the read/write head and incurring additional overhead to organize additional locations. This is file system fragmentation.

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.