From: Rusty Russell <rusty@rustcorp.com.au>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: matthew@hairy.beasts.org, manfred@colorfullife.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] Lightweight user-level semaphores
Date: Mon, 14 Jan 2002 12:35:41 +1100 [thread overview]
Message-ID: <20020114123541.3d9da876.rusty@rustcorp.com.au> (raw)
In-Reply-To: <E16PmKA-0007BS-00@the-village.bc.nu>
In-Reply-To: <Pine.LNX.4.33.0201131216230.24442-100000@sphinx.mythic-beasts.com> <E16PmKA-0007BS-00@the-village.bc.nu>
On Sun, 13 Jan 2002 15:13:30 +0000 (GMT)
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > Yep, that'd be fine. However, you then lose the neatness
> > of "lock==file descriptor", and need something other than
> > read/write for down/up.
>
> If I have to have 2000 pages and 2000 file handles for 2000 locks I've
> kind of lost interest. read/write syscalls take offsets. I can pread/pwrite
> a lock in a set of locks. The only reason for using an fd I can see is so
> you can poll on a lock. All the other neatness issues are wrapped in the
> library support code anyway.
My interest in this is for TDB (Trivial Database: see sourceforge). TDB
requires a lock per hash chain (ie. arbitrary number of locks), a number
which does not change. With an extended version of the fd code (ie. first
mmap controls size of map, and offset control which semaphore you are
referring to, and semaphores created on demand), this requires:
Each TDB would have an associated ".locks" unix domain socket so you can
read the fd from the "master". This must be atomically created by the
first process to open the TDB, and must be asynchronously serviced by a
process at all times (ie. when the "master" exits, someone else takes
over).
Without even mentioning the impossibility of creating a Unix domain socket
with an arbitrary path name (can't chdir, might not be able to chdir
back), or the problem of cleaning up the socket when noone is using the
tdb, or the horror which is fd passing under Unix, I think it's clear that
the fd solutions are vastly inferior to the "magic cookie" approach.
Still, it was cute hack.
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next prev parent reply other threads:[~2002-01-14 1:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-11 15:50 [PATCH][RFC] Lightweight user-level semaphores Manfred Spraul
2002-01-11 16:15 ` Matthew Kirkwood
2002-01-11 17:03 ` Alan Cox
2002-01-13 12:38 ` Matthew Kirkwood
2002-01-13 12:55 ` Manfred Spraul
2002-01-13 15:13 ` Alan Cox
2002-01-14 1:35 ` Rusty Russell [this message]
[not found] <Pine.LNX.4.33.0201081443540.8169-100000@penguin.transmeta.com>
2002-01-09 23:23 ` Matthew Kirkwood
2002-01-11 5:55 ` Rusty Russell
2002-01-11 11:40 ` Matthew Kirkwood
-- strict thread matches above, loose matches on Subject: below --
2002-01-07 20:05 Matthew Kirkwood
2002-01-07 20:28 ` Linus Torvalds
2002-01-07 22:03 ` Matthew Kirkwood
2002-01-07 22:38 ` Linus Torvalds
2002-01-08 13:56 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020114123541.3d9da876.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=matthew@hairy.beasts.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox