Hi Rick,
Could you please provide me reference where you read that mmap() implements on demand memory allocation?
I read it in "Understanding the Linux Kernel", 3rd Edition by Bovet and Cesati. In chapter 16 "Accessing files"..section "memory mapping a file" Below is the paragraph from the book which says it: File memory mapping depends on the demand paging mechanism described in the section "Demand Paging" in Chapter 9. In fact, a newly established memory mapping is a memory region that doesn't include any page; as the process references an address inside the region, a Page Fault occurs and the Page Fault handler checks whether the nopage method of the memory region is defined. If nopage is not defined, the memory region doesn't map a file on disk; otherwise, it does, and the method takes care of reading the page by accessing the block device. Almost all disk-based filesystems and block device files implement the nopage method by means of the filemap_nopage( ) function.
thanks, Rick
Adheer -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/