Re: read vs. mmap (or io vs. page faults)

From: Matthew Dillon <dillon_at_apollo.backplane.com>
Date: Mon, 21 Jun 2004 15:59:33 -0700 (PDT)
:
:ask for 8k, but the system will fetch the next 64k of data.  Problem is
:the system does nothing until you read the next 8k past the 64k
:alreqady read in, then it jumps up and grabs the next 64k.  You're
:still waiting on I/O every 8th read.  Ideally it would do an async
:..
:-- 
:	Dan Nelson
:	dnelson_at_allantgroup.com


    No, this isn't true.  The system places a marker 8K or 16K before the
    last read block and initiates the next read-ahead before you exhaust the
    first one.

    For mapped data the system intentionally does not map the page table entry
    for a page or two before the end of the read ahead in order to force a
    page fault so it can initiate the next read ahead.

    For read data the system marks a buffer near the end of the read ahead
    so when read encounters it the system knows to queue then next read-ahead.

    Also, for that matter, remember that the hard drives themselves generally
    cache whole tracks and do their own read-ahead.  This is why dd'ing a 
    large file usually results in the maximum transfer rate the hard drive
    can do.

					-Matt
					Matthew Dillon 
					<dillon_at_backplane.com>
Received on Mon Jun 21 2004 - 20:59:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:58 UTC