![]() |
Internal Fragmentation is a problem that occurs due to poor memory allocation and it results in wastage of memory. When a process is loaded into the system it requests memory which is essential for its working. The operating system allocates memory to processes to work with but if the memory happens to be smaller and bigger than the process requirement the extra space goes unused. This small amount of memory unutilization is the major Internal Fragmentation appearing in the Operating System. How Internal Fragmentation is Caused?When a process requests memory for working, most systems allocate the memory in fixed-sized blocks or pages. In most cases, the memory block that is being allocated is bigger than the amount of memory requested by the process. This is the main reason why Internal Fragmentation is caused. In some scenarios, a constant amount of memory is allocated to every process requesting for memory. Processes that request/require memory less than that of the constant amount end up wasting a good amount of allocated memory. This also ends up causing Internal Fragmentation. In some systems, memory is managed by tracking the allocated blocks of memory using some data structure ends up creating some memory overhead. This memory which is wasted to store and manage the data structure which is the tracker of the engaged memory ends up in Internal Fragmentation. Example: Let’s assume that the system that is being used assigns the memory in blocks of sizes being multiples of 4(like 12, 24, 32,..). In this system when a process P1 requests an amount of memory that is not a multiple of 4, it is assigned a memory block of value of the nearest higher multiple. For example, in this system if a process P1 requests a memory of 29kb, as it is not a multiple of 4 the process is assigned a memory of size 32kb as this is a multiple of 4. Now, the process will only use 29kb of memory, and the rest of the memory goes wasted. This wasted memory results in internal fragmentation. Effect of Internal FragmentationDue to Internal Fragmentation various types of effects occurs:
Why Internal Fragmentation is Allowed?As Internal Fragmentation is nothing but a problem there isn’t any significant advantage that it provides to the system. But there are a couple of things that favor causing it, which are:
Ways to Avoid Internal FragmentationThere are several ways to avoid Internal fragmentation. Some of them are mentioned below. Variable-Sized Allocation BlocksThe system can make blocks of various sizes and use Variable-sized allocation instead of Fixed Size Allocation. Now when the system gets a request for memory allocation, it can assign the best-fit memory block to that particular process. In this way, it can be assured that a minimum amount of memory space is being wasted. Dynamic Memory AllocationInstead of using the basic memory allocation system to allocate memory blocks to the processes, dynamic memory allocation methods can be used. Using these methods only a specific amount of memory is assigned to a process and minimal to no memory is wasted in the process. FAQs on Internal Fragmentation1. What causes Internal Fragmentation in OS?
2. Why is important to reduce Internal Fragmentation as much as possible?
3. Does Internal Fragmentation Affect Virtual Memory?
4. What is the difference between Internal Fragmentation and External Fragmentation?
5. Is it possible to completely eliminate Internal Fragmentation?
|
Reffered: https://www.geeksforgeeks.org
Operating Systems |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 17 |