News for hackers. Stuff that matters.
Re:How The Kernel Manages Your Memory by xpaulbettsx on Wednesday March 16, 2011 @01:24PM (#2332925)
One of the most important bits to pull out of this article, is that when you ask the kernel for memory, it doesn't actually do anything other than update its accounting of available memory and VA space - when you touch the page, you page fault and the kernel actually gives you a physical frame. The NT kernel (and I suspect any other production OS) works the same way.
Re:How The Kernel Manages Your Memory by ot on Wednesday March 16, 2011 @02:49PM (#2333338)
AFAIK there is a difference between Linux and NT: Linux allows overcommitting, while NT requires that every page has a "backing store", for example a physical RAM page, a swap page or a memory mapped file.

Thus when you touch the page, Linux may figure out that there is no memory that page can be mapped to it, but now it is too late because the application "believes" that the memory has been allocated. So the kernel kills the application (or, to be correct, an application) too free memory with an OOM exception. This is one of the reasons why it is good to have loads of swap even if the physical RAM is big enough for all the running processes.

Re:How The Kernel Manages Your Memory by nitrogen on Thursday March 17, 2011 @04:26AM (#2335455)
Or, if you know you won't be running applications that allocate more than they use, you can disable overcommission entirely.
Re:How The Kernel Manages Your Memory by scott_s on Wednesday March 16, 2011 @02:22PM (#2333216)
This point is in fact extremely important in understanding the behavior of real systems. The analogy I've used to explain it to students is that a memory map (mmap) or brk operation is like getting building permits from the city. You haven't created new buildings, but you've received permission to do so.
Re:How The Kernel Manages Your Memory by mcculley on Wednesday March 16, 2011 @02:48PM (#2333331)
Some Unixes that are meant to support real-time applications allow you to do an actual allocation. e.g., AIX had PSALLOC=early.
Re:How The Kernel Manages Your Memory by nitrogen on Thursday March 17, 2011 @04:28AM (#2335459)
See also mlock and mlockall for an approximation of this:

http://linux.die.net/man/2/mlockall