lkml.org 
[lkml]   [1996]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Problems in 1.3.93
Date
From
In message <96Apr23.084513+0100met_dst.2218-576+21@work.smurf.noris.de>,Matthia
s Urlichs writes:
> In linux.dev.kernel, article <4lgcah$4e1@flint.inr.ac.ru>,
> inr-linux-kernel@ms2.inr.ac.ru (really kuznet@ms2.inr.ac.ru) writes:
> >=20
> > All the textbooks (well, maybe, not all, I've read nothing=20
> > except for Stevens 8)8)) explain that nobody knows for what
> > mandatory locking was invented. Nobody knows useful applications
>
> You're reading the wrong textbooks.
>
> Assume, for instance, that you have a database with lots of readers but few
> writers. Any update will temporarily leave the database in an inconsistent
> state. You therefore need locking. With advisory locks, every reader must
> lock-read-unlock every piece of data it accesses, thereby requiring three
> times as many system calls.
>
Whereas with mandatory locking, if you only lock the areas you're writing,
the kernel has to check *every* I/O even to areas of the file which are
unaffected, *and* you still have as many system calls if, as frequently
happens, the reader needs to read multiple areas and these must remain "in
sync" (since the reader still has to make locking calls).

Mandatory locking is evil and wrong. It is very difficult to implement
correctly
and efficiently and effectively buys you nothing. The only time I've ever seen
it used was on mailboxes in the mistaken belief that it would somehow protect
the users in the face of a mail delivery program which didn't use any locking
itself (which of course it did not).

This is not meant as a flame to the author of the changes. I have no doubt
that they are "good" and were provided with the best of intentions. However,
I strongly feel that mandatory locking should not exist, and if it's not
mandated by Posix, I would vote against the code being in the Linux kernel
(at least by default i.e. make it configurable with a default of NO).

t

--
Tim Wright, Worldwide Technical Services, | Email: timw@sequent.com
Sequent Computer Systems Inc., 15450, |
SW Koll Parkway, Beaverton, Oregon 97006 | Phone: +1-503-578-3822
"Nobody ever said I was charming, they said "Rimmer, you're a git!"" RD VI



\
 
 \ /
  Last update: 2005-03-22 13:37    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site