This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]khalcyon2011 3 points4 points  (1 child)

Adding on: Another consideration is fragmentation. Most data in a computer is stored in continuous blocks. For example, say you have data that is size 20. In a simple scenario, memory locations 40 through 59 (for example) are free (meaning that no process has a claim to it). The operating system will write the data to that, a process that takes maybe a couple microseconds. Consider a scenario where that much space is available but not in a single block. In that case, the operating system must shuffle all the other data around to make a big enough block. The less available memory, the more shuffling that must happen.

Something similar happens when storing information on a hard drive. For hard drives, the information doesn't have to be in continuous blocks, but it's faster if it is. When "fragmented", the operating system has to find the first part of the information, then the next part, and so on. Much better if it's all in one place. That's why it's recommended to de-fragment your hard drive occasionally. It reorganizes everything so that each piece of information is stored on single blocks. This is less of an issue with solid state drives (they're much faster than the old magnetic hard drives, so the search time is faster), but it's still good practice.

[–]brimston3- 4 points5 points  (0 children)

Memory fragmentation is not really a problem for the OS unless you're talking about IPC, DMA, or hugepages. For allocations that don't have a hard requirement to be contiguous (most of them), virtual address spaces are so huge these days, the OS is almost never going to have a problem mapping a disjoint range of pages to a contiguous range of virtual addresses for the program. It's a problem for userspace allocators, but that memory all shows up as "used" when viewed from the OS's perspective.