I want to know what is the exact meaning of fragmentation with respect to computer and what do you mean by data fragmentation?
I want to know what is the exact meaning of fragmentation with respect to computer and what do you mean by data fragmentation?
Definition:
Data fragmentation occurs when a piece of data is not able to fit in (available)memory-slot as a whole and is broken up into many pieces (that are not close together) so that each piece is able to fit the available memory locations.
Example: the files in a file system are usually managed in units called blocks or clusters. When a file system is created, there is free space to store file blocks together contiguously. This allows for rapid sequential file reads and writes. However, as files are added, removed, and changed in size, the free space becomes externally fragmented, leaving only small holes in which to place new data. When a new file is written, or when an existing file is extended, the new data blocks are necessarily scattered, slowing access due to seek time and rotational delay of the read/write head, and incurring additional overhead to manage additional locations. This is called file system fragmentation.
Basically, two types of fragmentation occurs:
- Internal fragmentation
- External fragmentation
Internal fragmentation
Internal fragmentation occurs when storage is allocated without ever intending to use it. This space is wasted. It is often accepted in return for increased efficiency or simplicity.
The term "internal" refers to the fact that the unusable storage is inside the allocated region but is not being used.
External fragmentation
External fragmentation is the phenomenon in which free storage becomes divided into many small pieces over time. It is a weakness of certain storage allocation algorithms, occurring when an application allocates and deallocates ("frees") regions of storage of varying sizes, and the allocation algorithm responds by leaving the allocated and deallocated regions interspersed. The result is that although free storage is available, it is effectively unusable because it is divided into pieces that are too small to satisfy the demands of the application.
The term "external" refers to the fact that the unusable storage is outside the allocated regions.
In programming, data fragmentation is of great use and a feature while managing linked lists.
When the nodes of a linked list are allocated consecutively in memory which improves locality of reference and enhances data cache performance during traversal of the list. If the memory pool's free space is fragmented, new nodes will be spread throughout memory, increasing the number of cache misses.
Bookmarks