Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 May 2000 16:11:07 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Sergey Babkin <babkin@bellatlantic.net>
Cc:        Ville-Pertti Keinonen <will@iki.fi>, FengYue <fengyue@bluerose.windmoon.nu>, hackers@FreeBSD.ORG
Subject:   Re: Why this works?
Message-ID:  <20000512161107.A19644@fw.wintelcom.net>
In-Reply-To: <391C7CDA.F9B477B7@bellatlantic.net>; from babkin@bellatlantic.net on Fri, May 12, 2000 at 05:51:22PM -0400
References:  <20000511210915.A38341@Hamilton-ppp44812.sympatico.ca> <Pine.BSF.4.10.10005111955220.29094-100000@bluerose.windmoon.nu> <864s84cq35.fsf@not.demophon.com> <20000512005806.A29302@fw.wintelcom.net> <391C7CDA.F9B477B7@bellatlantic.net>

next in thread | previous in thread | raw e-mail | index | archive | help
* Sergey Babkin <babkin@bellatlantic.net> [000512 15:23] wrote:
> Alfred Perlstein wrote:
> > 
> > * Ville-Pertti Keinonen <will@iki.fi> [000511 22:49] wrote:
> > >
> > > fengyue@bluerose.windmoon.nu (FengYue) writes:
> > >
> > > > loop.  Now, the third program reads 4K of data from /tmp/pagetest
> > > > and exit if the 4K data does not contain all 'A's nor 'Z's.  3 programs
> > > > run concurrently on the same machine (3.4).  No lock in the code whatsoever,
> > >
> > > Not quite.  If FreeBSD didn't perform locking, operations affecting
> > > single filesystem blocks would probably be atomic (as long as the
> > > userland buffer is in memory).
> > >
> > > However, FreeBSD does perform locking in read(2) and write(2) for
> > > local files, so your third program should never fail and exit.
> > >
> > > Note that the system call interface does not guarantee reads or writes
> > > to be atomic, this just happens to be how it is implemented at the
> > > moment.
> > 
> > Afaik several Unix standards mandate this behavior, Linux doesn't
> > follow this standard though.
> 
> Sounds like one more of these subtle weirdnesses in Linux that
> annoy me so much :-(

This weirdness is intentional, it's a shortcut for speed taken at
the expense of real unix compatibility.

> Solaris seems to be another example a system with not quite atomic
> writes. The writes themselves seem to be atomic but in append mode the
> positioning at the end of file is not atomic with writes. So when
> appending to a log file from multiple sources the messages tend to
> overlap (be written at the same position).

That's why I use FreeBSD, it works. :)

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000512161107.A19644>