Subject: Re: Is Greenspun enough?
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 09 Dec 2005 22:57:42 -0600
Newsgroups: comp.lang.lisp
Message-ID: <YsCdnZJ-SdXb_QfenZ2dnUVZ_v-dnZ2d@speakeasy.net>
George Neuner  <gneuner2/@comcast.net> wrote:
+---------------
| I don't think it's possible in most current OSes to bypass the file
| cache when reading using standard I/O calls.
+---------------

But note than many current operating systems, expecially those that
support high-performance filesystems like XFS (which includes Irix
and Linux, at a minimum), provide an O_DIRECT mode bit in "open()"
which *does* bypass the cache. From "man 2 open" on Linux:

    O_DIRECT
       Try to minimize cache effects of the I/O to and from this  file.
       In  general  this  will degrade performance, but it is useful in
       special situations, such  as  when  applications  do  their  own
       caching.   File I/O is done directly to/from user space buffers.
       The I/O is synchronous, i.e., at the completion of  the  read(2)
       or  write(2) system call, data is guaranteed to have been trans-
       ferred.  Under Linux 2.4 transfer sizes, and  the  alignment  of
       user buffer and file offset must all be multiples of the logical
       block size of the file system.  Under  Linux  2.6  alignment  to
       512-byte boundaries suffices.
       A  semantically similar interface for block devices is described
       in raw(8).


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607