I want to find the total external and internal fragmentation. What I understand is that external fragmentation occurs when processes are loaded and removed from memory, causing memory to be broken into little pieces, and that internal fragmentation is the unused memory internal to a partition.
As an example, say I had the following memory holes: 50 KB, 400 KB, 130 KB, 300 KB, 150 KB, and 70 KB (in that order). Now I have the following processes that need the following memory space (in order): A = 230 KB, B =180 KB, C = 130 KB, D = 120 KB, E = 200 KB.
Using the first fit method, I have determined the following allocation:
50 KB hole is assigned 0 processes -> 50 KB free
400 KB hole is assigned processes A and C -> 40 KB free
130 KB hole is assigned process D -> 10 KB free
300 KB hole is assigned process B -> 120 KB free
150 KB hole is assigned 0 processes -> 150 KB free
70 KB hole is assigned 0 processes -> 70 KB free
So, based on my understanding of the definitions:
Total internal fragmentation = 50 KB + 150 KB + 70 KB = 270 KB
Total external fragmentation = 40 KB + 10 KB + 120 KB = 170 KB
Is this correct? Thanks.