Fragmentation of the main memory of the operating system

Suppose a small computer system has 4 MB of main memory. The system manages it in frames of a fixed size. The frame table maintains the state of each frame in memory. How big (how many bytes) should the frame be? You have a choice of one of the following: 1K, 5K or 10K bytes. Which of these options minimizes the total space spent by processes due to fragmentation and storage of frame tables?

Suppose the following: on average, 10 processes will be in memory. The average amount of lost space will be 1/2 frame for each process. The frame table should have one entry for each frame. Each entry requires 10 bytes.


Here is my answer:

1K minimizes fragmentation, since the known small size results in large tables, but less wasted space.

10 processes ~ 1/2 frame wasted for each.


Am I on the right track?

+4
source share
1 answer

Yes you. I agree with you that in such a system, the smallest size makes the most sense. However, for example, if you take the situation with x86-64, where the parameters are 4kb, 2MB, 1GB. Given the current size of 4 GB approximation memory, it is obvious that 1 GB does not make sense, but since most programs currently contain quite a lot of compiled code, or in the case of interpreted and virtual languages, the entire code of VM pages, 2 MB makes the most sense. In other words, to determine these things, you need to think about the average memory usage in a program in this system, the number of programs, and, most importantly, the average fragmentation size for the page table size. Since while a small memory size like this benefits from low fragmentation, 4kb pages per 4 GB of memory is a very large page table. Very big.

0
source

Source: https://habr.com/ru/post/1446859/


All Articles