0
$\begingroup$

I am currently studing questions but stuck on this one, I hope someone can help me out to understand.

Question: Assume that we have a paged virtual memory with a page size of 4Ki byte. Assume that each process has four segments (for example: code, data, stack, extra) and that these can be of arbitrary but given size. How much will the operating system loose in internal fragmentation?

The answer is: Each segment will in average give rise to 2Ki byte of fragmentation. This will in average mean 8 Ki byte per process. If we for example have 100 processes this is a total loss of 800 Ki byte.

My question: That 2Ki byte each segment is confusing but I think that is just a guess. Anyway, if we have 8Ki byte per process, that would not even fit in a 4Ki byte page isn't that actually a external fragmentation? Can someone explain the correct answer that is easier to understand?

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. If each page is 4 KB and segment has arbitrary size, then you lose from 0 to 4095 bytes on each segment, i.e. 2 KiB at average
  2. I think it can be called internal fragmentation for pages, but external one for segments
$\endgroup$
2
  • $\begingroup$ @Bulbat thanks for the answer, a question tho, the page table is per process, and each process has four segments, if one segment can lose from 0 to 4095, how about the other three segments? Shouldn't it be each process can lose from 0 to 4095? $\endgroup$
    – nihulus
    Commented Apr 21, 2019 at 17:50
  • $\begingroup$ Each segment is independent, so you can lose up to 4*4095 bytes, i.e. 8 KiB at average. $\endgroup$
    – Bulat
    Commented Apr 21, 2019 at 19:26

Your Answer

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

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