What they don’t tell you about demand paging in school
<i>&quot;In Operating Systems 101 we learn that operating systems are “lazy” when they allocate memory to processes. When you mmap() an anonymous page, the kernel slyly returns a pointer immediately. It then waits until you trigger a page fault by “touching” that memory before doing the real memory allocation work”.</i><p>Some operating systems do that, some don&#x27;t. IBM&#x27;s AIX variant of UNIX allocated space when you asked for it, not when an instruction touched the page. The advantage is that you find out if you don&#x27;t have enough memory when you make the system call to request it, not by having the program killed.<p>(It may be time for paging out to disk to go away. It&#x27;s a huge performance hit. Mobile doesn&#x27;t do it. And RAM is so cheap.)