<div dir="ltr"><div><div><div>> Default read/write inerfaces does not move file's data to process address space ?<br></div>Yes it does, in either case, user space memory has to be in process address space. But Difference is in the access pattern. With read/write, you demand for it explicitly through a system call, hence application is more involved here. While for mmap access, all transfer happens in application-unaware mechanism, with page-fault handlers inside kernel. Application just access mapped buffers like memory array and magic happens inside kernel as you keep on accessing bytes.<br>
<br></div>Best way to find out difference is to try out writing a simple mmap program.<br><br></div>-Rajat<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 3:31 AM, horseriver <span dir="ltr"><<a href="mailto:horserivers@gmail.com" target="_blank">horserivers@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Jan 11, 2013 at 12:39:26PM +0530, Rajat Sharma wrote:<br>
<br>
> Default read/write inerfaces are better suited for sequential read/write<br>
> within your program. Although you can seek to any location within the file,<br>
> you still have overhead to issue system calls to get data. However mmap<br>
> allows you to map a section of file into program address space.<br>
<br>
</div> Default read/write inerfaces does not move file's data to process address space ?<br>
<br>
when r/w a file descript which returnd by open() , how do the file data move from one place to another place ?<br>
<br>
For each time the write function being called , will kernel call filesystem's driver's write to respond ??<br>
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<br>
data which is got by filesystem's read operation ?<br>
<br>
Am I right?<br>
<br>
Thanks!<br>
<div class="HOEnZb"><div class="h5">><br>
><br>
> -Rajat<br>
><br>
><br>
> On Fri, Jan 11, 2013 at 2:44 AM, horseriver <<a href="mailto:horserivers@gmail.com">horserivers@gmail.com</a>> wrote:<br>
><br>
> > hi:<br>
> ><br>
> > these two wayes of operating one file :<br>
> ><br>
> > 1.use open/write interface call .<br>
> ><br>
> > 2.mmap this file into memory , then access this memory area and do r/w .<br>
> ><br>
> > what is the essential difference between this teo wayes?<br>
> ><br>
> > thanks!<br>
> ><br>
</div></div></blockquote></div><br></div>