From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 4 18:13:50 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from green.homeunix.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C0E0516A4CE; Sun, 4 Jul 2004 18:13:49 +0000 (GMT) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.12.11/8.12.11) with ESMTP id i64IDnVX002194; Sun, 4 Jul 2004 14:13:49 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.12.11/8.12.11/Submit) id i64IDm1f002193; Sun, 4 Jul 2004 14:13:48 -0400 (EDT) (envelope-from green) Date: Sun, 4 Jul 2004 14:13:47 -0400 From: Brian Fundakowski Feldman To: Stephen Hurd Message-ID: <20040704181347.GE997@green.homeunix.org> References: <20040624174919.46160f9e.shurd@sasktel.net> <20040628192935.GF5635@green.homeunix.org> <20040630192041.1d9c5348.shurd@sasktel.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040630192041.1d9c5348.shurd@sasktel.net> User-Agent: Mutt/1.5.6i cc: freebsd-hackers@freebsd.org Subject: Re: Locking: kern/50827 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jul 2004 18:13:50 -0000 On Wed, Jun 30, 2004 at 07:20:41PM -0600, Stephen Hurd wrote: > > > Has anyone looked at this? Does anyone have any comments? > > > > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/50827 > > > > I don't think you'll ever find anyone interested in file locking > > anymore. Since they're all advisory, anyway, you can just implement them > > at a higher level in your application. BSD and System V IPC mechanisms > > already are very good building blocks here for system-scoped locks. > > Hrm? I'm sort of confused... file locking is still the best way of doing > erm... file locking. A few points: > > 1) File locking works with any program using the file locking API. > Hand-rolled implementations will only work with other programs which use > the same hand-rolled routines. > 2) File locking works across NFS, so you aren't limited to the local > system. > 3) There's no simple way of doing per-descriptor locks using BSD and SysV > IPC... ie: locks which are automatically released when the file descriptor > used to obtain the lock is released. This also of course means programs > which core won't leave stale locks laying around. > > Essentially, implementing locks at a higher level is alway more difficult, > usually more prone to problems, and in some cases introduces more overhead > than the rest of the program. > > The only reason I can think of for implementing locks at a higher level is > for cross-platform code... Right, if you just make it cross-platform in the first place using higher- level primitives you don't have to worry what the specific kernel and operating system and file system you are using provides. It's my opinion tha there won't be other people adopting this API for file locking since it is by definition not meant to work like the standardized APIs. I don't think that there's no value in having more useful locking primitives, but they probably don't benefit much from being implemented in the kernel unless they conform to a portable API. I certainly always have my own various kernel modifications that I find useful, but aren't very standard :) -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\