Search This Blog

Tuesday, March 8, 2011

what is fragmentation ?

Fragmentation refers to the inefficient storage of the memory space.

  • It leads to low storage capacity and performance degradation to say the least.
  • There are 3 different types of fragmentation that can be seen in GPOS i.e External, internal and Data fragmentation
Internal Fragmentation: storage allocated by the OS to increase the efficiency. 
  • These storage is present inside the allocated region but never being used. Hence gets the term "internal"
  • instances -- structure padding, the padding is done to increase the CPU read and write cycle but is unusable and is wasted 
  • File starts from the beginning of a cluster, so the space between the EOF and the beginning of the next cluster called File slack is wasted
External Fragmentation:This problem arises due to the inefficient storage allocation algorithms
  • Every time an application asks for data allocation/deallocation then the continues memory is left fragmented, not contiguous
  • Since this happens outside the allocated area it is called external fragmentation
  • Ideally we would expect OS as a memory manager, would serialize all the available memory but performing this is not as simple as this text :-)
  • This can lead to problem like application asking for 1024 bytes of memory but we are left with 1000 bytes, 300 bytes, 230 bytes of chunk of memory. This would result in the memory allocation failure even though we have enough memory left in our RAM
Data fragmentation: This problem arises when related memory chunks are non-continues i.e. broken up into many segments and each not close to each other. Here related memory implies that the memory used for storing some file, image etc that which ideally would be expected to be stored in continues memory location
  • This lead to increase in seek time i.e. data fetch time
  • A file or an image etc with data fragmented are stored in different memory location are linked together using the linked list. So to open a file, it might take to traverse a linked list of segments of memory which holds that file information. 
Note: Data fragmentation is a possible scenario to highlight the application of linked list in interviews




No comments:

Post a Comment