0
$\begingroup$

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.

$\endgroup$
3
  • 1
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$ Nov 13, 2016 at 23:45
  • $\begingroup$ Yes, the conceptual issue is finding the total external and internal fragmentation. It's the title of the question. I provided an example as an attempt to answer my own question. $\endgroup$
    – jshapy8
    Nov 13, 2016 at 23:47
  • $\begingroup$ What does "the fragmentation" actually measure? I don't even know what units are appropriate to describe a quantity with this name -- but it seems very unlikely that it would simply be a number of bytes formed by summing the size of each fragment, simply because then "the fragmentation" of a single hole of size 270KB would be the same as "the fragmentation" of 270 holes, each of size 1KB, when clearly any meaningul measure would assign a bigger number to the latter. $\endgroup$ Nov 14, 2016 at 11:07

4 Answers 4

1
$\begingroup$

First of all you need to specify whether your partitions are fixed size or variable size. In case they are using dynamic partitioning(variable size) the internal fragmentation will always be 0 since its defined only for fixed size partitioning. Now assuming your partitioning is static, total internal fragmentation will be the sum of all internal fragmentations. And for external fragmentation it is equal to the total free memory available(holes plus contiguous free memory). Therefore External fragmentation here will be (50 + 40 + 10 + 120 + 150 + 70)KB = the total free memory available = total unused memory. While internal fragmentation will be (40+10+120)KB the partitions which are not used will not be counted since they are not allocated to any process. External fragmentation is a superset of internal fragmentation in case of fixed size partitioning.

$\endgroup$
1
$\begingroup$

The first fit placement algorithm is used for dynamic allocation. In dynamic allocation, there is no internal fragmentation!!!! Internal fragmentation is a memory that was reserved by the process but was not used in dynamic allocation reserve memory by request of the process. If the process request is 50MB, then 50MB will be allocated so that all memory will be used. Only external fragmentation has to be counted. Just add all free partitions.

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

I am teaching OS, by the way. I hope that will help!

$\endgroup$
1
  • $\begingroup$ (From the post edit help box (to the right of the post editor in non-narrow windows): for linebreak add 2 spaces at end.) $\endgroup$
    – greybeard
    Dec 6, 2021 at 6:54
0
$\begingroup$

According to the problem ,process A is allocated to 400 KB memory ,so the memory is split into two part , one to satisfy the request and remaining (170 KB) is type of external fragmentation denoted by (170 KB E) .

Similarly for process B using 300 KB that results 120 KB E.

Similarly for process c using (170 KB E) results (40 KB E).

Similarly for process D using (130 KB) results (10 KB E) request of process E can't be completed So total external fragmentation = 40 +10+120=170 KB

Total internal fragmentation = 50 + 150 + 70=270 KB

$\endgroup$
0
$\begingroup$

NO! The Total Internal Fragmentation is 40 + 10 + 120 = 170kB And Total External Fragmentation is 50 +150 + 70 = 270kB

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.