Thanks! So there is kind of a page of buffer area lying there... -----Original Message----- From: Luciano A. Stertz [mailto:luciano@xxxxxxxxxxxx] Sent: Friday, July 16, 2004 2:51 PM To: Lei Yang Cc: kernelnewbies@xxxxxxxxxxxx Subject: Re: memory-mapped files Lei Yang wrote: > Could anyone pls tell me what exactly happens when an executable sitting in hard disk is running? > > I understand that the file will be "memory-mapped". Since the requested data is not in RAM when it is read, kernel would try to read from the file region that does not exist in physical memory. A page fault is generated, which traps into the virtual memory management system. This system then allocates physical memory, then schedules a file read to bring the data into memory. > > I am a little bit confused here, is that when the page fault is generated, kernel will load pages of data of executable file from hard disk to a certain buffer area in memory and then map this area to process address space; or is the file itself on hard disk mapped to address space? When the page fault happens, the kernel reads a whole page of data from disk to a 'struct page' and sets the process' page table to point to this page. > Thank you in advance! > > Lei > > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > -- Luciano A. Stertz luciano@xxxxxxxxxxxx T&T Engenheiros Associados Ltda http://www.tteng.com.br Fone/Fax (51) 3224 8425 -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/