CST334 OS More Memory Management!
This week we continued our learning about memory management. The main topics were paging and swapping.
Paging is a challenge because even keeping track of all the pages can take up an enormous amount of space in memory. But, if the paging structure can be reduced to just the entries that are occupied, then we can avoid tracking the empty pages and only address the pages in use. The page directory is the structure used to do so. The page directory only tracks the pages in use; no need to track empty pages. This does require some additional overhead in the storage of page directory bits. But the payoff is big in the form of freed memory.
Swap memory lets us access a memory space beyond our physical RAM. Less used pages are written to the swap file. If they are required again, they can be promoted back into RAM; at that time, another lesser used page will be written to the swap file. This is a kind of caching where the most in demand pieces of memory are available in RAM, while lesser needed data is written to disk. Virtual memory is still backed by this system, and so the process is unaware of the background activity.
I've grown up with the pagefile and swapfile on my Windows partition. I vaguely understood that it something to do with memory, and correlated to the amount of RAM that was installed on my system. Now, I can appreciate the work those reserved sections of the HD or SSD are doing.
During some of the assignment work this week, I googled the page size of my M4 MacBook Air. From the initial result, it looks like the M4 uses a larger page size of 16kb instead of 4kb. It seems that the M4 CPU is less concerned about internal fragmentation than it is with tracking a large page index. Does that sound right?
Comments
Post a Comment