From mboxrd@z Thu Jan 1 00:00:00 1970 From: horserivers@gmail.com (horseriver) Date: Fri, 11 Jan 2013 06:01:34 +0800 Subject: internel implemention of file operation In-Reply-To: References: <20130103065931.GA20892@debian.localdomain> <20130110211443.GA4817@debian.localdomain> Message-ID: <20130110220134.GB4817@debian.localdomain> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Jan 11, 2013 at 12:39:26PM +0530, Rajat Sharma wrote: > Default read/write inerfaces are better suited for sequential read/write > within your program. Although you can seek to any location within the file, > you still have overhead to issue system calls to get data. However mmap > allows you to map a section of file into program address space. Default read/write inerfaces does not move file's data to process address space ? when r/w a file descript which returnd by open() , how do the file data move from one place to another place ? For each time the write function being called , will kernel call filesystem's driver's write to respond ?? In my opinion,kernel will passed a buffer's head address which is passed form user-layer into driver,then driver will fill this buffer with file's data which is got by filesystem's read operation ? Am I right? Thanks! > > > -Rajat > > > On Fri, Jan 11, 2013 at 2:44 AM, horseriver wrote: > > > hi: > > > > these two wayes of operating one file : > > > > 1.use open/write interface call . > > > > 2.mmap this file into memory , then access this memory area and do r/w . > > > > what is the essential difference between this teo wayes? > > > > thanks! > >