There are two types of fragmentation in OS which are given as: Internal fragmentation, and External fragmentation.
Internal fragmentation happens when the memory is split into mounted sized blocks. Whenever a method request for the memory, the mounted sized block is allotted to the method. just in case the memory allotted to the method is somewhat larger than the memory requested, then the distinction between allotted and requested memory is that the Internal fragmentation.
The above diagram clearly shows the internal fragmentation because the difference between memory allocated and required space or memory is called Internal fragmentation.
External fragmentation happens when there’s a sufficient quantity of area within the memory to satisfy the memory request of a method. however the process’s memory request cannot be fulfilled because the memory offered is during a non-contiguous manner. Either you apply first-fit or best-fit memory allocation strategy it’ll cause external fragmentation.
In above diagram, we can see that, there is enough space (55 KB) to run a process-07 (required 50 KB) but the memory (fragment) is not contiguous. Here, we use compaction, paging or segmentation to use the free space to run a process.
Difference between Internal fragmentation and External fragmentation:-
|S.NO||Internal fragmentation||External fragmentation|
|1.||In internal fragmentation fixed-sized memory, blocks square measure appointed to process.||In external fragmentation, variable-sized memory blocks square measure appointed to method.|
|2.||Internal fragmentation happens when the method or process is larger than the memory.||External fragmentation happens when the method or process is removed.|
|3.||The solution of internal fragmentation is best-fit block.||Solution of external fragmentation is compaction, paging and segmentation.|
|4.||Internal fragmentation occurs when memory is divided into fixed sized partitions.||External fragmentation occurs when memory is divided into variable size partitions based on the size of processes.|
|5.||The difference between memory allocated and required space or memory is called Internal fragmentation.||The unused spaces formed between non-contiguous memory fragments are too small to serve a new process, is called External fragmentation .|
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Internal static variable vs. External static variable with Examples in C
- IPv6 Fragmentation Header
- Fragmentation at Network Layer
- IPv4 Datagram Fragmentation and Delays
- Difference Between DVD-R and DVD+R
- Difference between Blu-ray and DVD
- Difference between ELT and ETL
- Difference between URL and URI
- Difference between CLI and GUI
- Difference between WCF and Web API
- Difference between DTE and DCE
- Difference between SQL and T-SQL
- Difference between LAN, MAN and WAN
- Difference between CD and DVD
- Difference between CPU and GPU
- Difference between Blu-ray and HD DVD
- Difference between LAN and WAN
- Difference between IoE and IoT
- Difference between SSH and SSL
- Difference between RPC and RMI
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.