Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!inquo!in-news.erinet.com!imci5!imci4!newsfeed.internetmci.com!swrinde!elroy.jpl.nasa.gov!decwrl!news.zocalo.net!news From: Shankar Unni <shankar@chromatic.com> Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,comp.unix.solaris,comp.unix.bsd Subject: Re: How to flush write buffer ? Date: Wed, 12 Jun 1996 10:08:32 -0700 Organization: Chromatic Research Lines: 28 Distribution: inet Message-ID: <31BEF990.51901C91@chromatic.com> References: <4pg906$8su@sjx-ixn3.ix.netcom.com> <4phgrp$3hd@dawn.mmm.com> <4pigbq$qgb@dfw-ixnews3.ix.netcom.com> NNTP-Posting-Host: 140.174.118.107 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0b4Gold (X11; I; Linux 1.3.100 i586) To: Hugh McCurdy <hmccurdy@ix.netcom.com> Xref: euryale.cc.adfa.oz.au comp.unix.programmer:38358 comp.os.linux.development.apps:17495 comp.unix.solaris:71591 comp.unix.bsd:16801 Hugh McCurdy wrote: > I must be using "logically" incorrectly or something. To me a > "logical write" would be a write that would allow other processes to > have access to the data written. Absolutely. And even for buffered writes, almost all systems really *do* treat the buffers as if they were a cache; i.e. if one program writes the file (but the stuff is still in kernel buffers), and another program requests a read from that file, the kernel will return the buffer contents, not the disk contents. The main reason for *synchronous* writes is to avoid problems with system crashes and the like, where the kernel buffers are *not* written back correctly. For instance, many OSes do asynchronous writes for ordinary files by default, but synchronous writes for *directory* updates, because those data structures are sensitive, and an incorrect or partial directory update can *really* screw up your file system.. Typical candidates for synchronous writes (or at least, a synchronizing operation) are database transactions (where you want to atomically commit a transaction with some guarantee of completion), directory updates, etc. -- Shankar Unni shankar@chromatic.com Chromatic Research (408) 752-9488