[lkml]   [1996]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Problems in 1.3.93
In message <>,Matthia
s Urlichs writes:
> In, article <4lgcah$>,
> (really 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
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).


Tim Wright, Worldwide Technical Services, | Email:
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    [W:0.114 / U:1.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site