public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@warthog.cambridge.redhat.com>
To: "Alon Ziv" <alonz@nolaviz.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: light weight user level semaphores
Date: Mon, 23 Apr 2001 16:40:04 +0100	[thread overview]
Message-ID: <4586.988040404@warthog.cambridge.redhat.com> (raw)
In-Reply-To: Your message of "Mon, 23 Apr 2001 16:48:25 +0200." <015001c0cc04$748c4860$910201c0@zapper>

Alon Ziv <alonz@nolaviz.org> wrote:
> Obviously... since they're handles, not FDs...
> [BTW, are you using Windows' idea of storing the objects in process space,
> in a page that's inaccessible to the app itself, and passing pointers into
> this page as the handles?]

No... I grab a page in kernel space and use it as an array. One problem is
that if an exit occurs, I have to be able to discard all attached objects
after the process's VM has been cleaned up (ie: what if it gets swapped
out?). Plus, mmap can clobber existing mappings, MapViewOfFile can't.

> So what if they aren't files?

Small structures private to my Win32 module.

> I'm afraid I'm not following your logic in this; I believe most Win32 attrs
> can be mapped to more generic abstractions which should be able to exist at
> 'struct file' level.

"Most"...

It'd mean adding extra fields into struct file (and possibly struct inode)
just for the use of this module (which probably wouldn't be accepted).

> (And even if not, a Win32 file handle could just hold two pointers---

No. the extra data has to be accessible from CreateFile (potentially running
in other processes), and this'd mean it'd have to go speculatively searching
all Win32 handle tables currently in use.

> And breaks _completely_ with the existing scheme :-/

So what? This is for a WINE accelerator/Win32 module only. There's already
been an argument over making the whole lot available as general Linux
functionality, but most people said that it'd be a bad idea because it'd not
be portable.

> Huh? Where did you get this?
> Looking at my copy of MSDN (July '00), the PulseEvent remarks more-or-less
> suggest an implementation like
>     SetEvent(e)
>     ResetEvent(e)

Consider the following:

	WAITER 1	WAITER 2	WAITER 3	WAKER
	wait-on-event	wait-on-event	wait-on-event
	sleep		sleep		sleep
							PulseEvent
							set-event
							wake(WAITER 1)
							wake(WAITER 2)
							wake(WAITER 3)
							reset-event
	wake		wake		wake
	what-happened?	what-happened?	what-happened?
	nothing!	nothing!	nothing!
	sleep		sleep		sleep

All three waiters should wake up with a note that the event triggered, but
they don't. Plus a fourth waiter who begins to wait on the event after the
set-event is issue probably shouldn't wake up.

> I wonder if it's possible to add _just_ this to poll()...

No... there's no way to pass this to poll (or select).

Better to add a WaitForMultipleObjects() syscall and have that call
do_select() with a flag.

David

  reply	other threads:[~2001-04-23 15:41 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010417114433.D1108@w-mikek2.sequent.com>
2001-04-17 19:48 ` light weight user level semaphores Linus Torvalds
2001-04-18 18:13   ` Bernd Eckenfels
2001-04-18 19:35   ` Ulrich Drepper
2001-04-19  8:20     ` Alon Ziv
2001-04-19  8:52       ` Abramo Bagnara
2001-04-19  9:08         ` Alexander Viro
2001-04-19 10:44           ` Abramo Bagnara
2001-04-19 16:11         ` Linus Torvalds
2001-04-19 16:33           ` Alexander Viro
2001-04-19 16:43             ` Linus Torvalds
2001-04-19 17:33               ` Alexander Viro
2001-04-19 17:38                 ` Linus Torvalds
2001-04-19 18:24                   ` Alexander Viro
2001-04-19 19:26                   ` Ulrich Drepper
2001-04-19 19:35                     ` Alan Cox
2001-04-19 20:06                       ` Ulrich Drepper
2001-04-19 20:11                         ` Alan Cox
2001-04-19 20:26                           ` Ulrich Drepper
2001-04-19 20:22                     ` Ingo Oeser
2001-04-19 20:40                       ` Ulrich Drepper
2001-04-19 20:51                       ` Linus Torvalds
2001-04-19 21:38                       ` Alan Cox
2001-04-19 20:49                     ` Linus Torvalds
2001-04-19 21:18                       ` Ulrich Drepper
2001-04-19 21:41                         ` Linus Torvalds
2001-04-19 22:46                           ` Ulrich Drepper
2001-04-20  1:35                             ` Alexander Viro
2001-04-20  2:45                               ` Ulrich Drepper
2001-04-19 16:43           ` Abramo Bagnara
2001-04-19 20:47           ` Ingo Oeser
2001-04-19 20:54             ` Linus Torvalds
2001-04-19  9:08       ` Ingo Oeser
2001-04-19 11:51       ` Alan Cox
2001-04-19 16:03       ` Linus Torvalds
2001-04-19 16:38         ` Alan Cox
2001-04-19 16:46           ` Linus Torvalds
2001-04-19 17:12             ` Alan Cox
2001-04-19 22:35               ` Rogier Wolff
2001-04-20  9:29             ` Olaf Titz
2001-04-20 14:19               ` Jesse Pollard
2001-04-20 18:36                 ` Olaf Titz
2001-04-20 23:33               ` Linus Torvalds
2001-04-21  4:06                 ` fd allocation [was: light weight user level semaphores] Edgar Toernig
2001-04-22  9:48                   ` Olaf Titz
2001-04-22 11:41                     ` light weight user level semaphores Alon Ziv
2001-04-22 12:44                       ` Alan Cox
2001-04-22 15:19                         ` Alon Ziv
2001-04-22 14:31                           ` Alexander Viro
2001-04-22 16:08                             ` Alon Ziv
2001-04-22 11:41                     ` Alon Ziv
2001-04-22 14:18                     ` David Woodhouse
2001-04-23 13:19                       ` David Howells
2001-04-23 14:48                         ` Alon Ziv
2001-04-23 15:40                           ` David Howells [this message]
2001-04-21 10:13                 ` Olaf Titz
2001-04-23 15:34                 ` Jeff Garzik
2001-04-23 19:18             ` Ingo Oeser
2001-04-24  0:19             ` David Wagner
2001-04-24  0:41               ` Alexander Viro
2001-04-19 19:47           ` Ulrich Drepper
2001-04-19 18:48         ` Olaf Titz
2001-04-19 13:59 George Talbot

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=4586.988040404@warthog.cambridge.redhat.com \
    --to=dhowells@warthog.cambridge.redhat.com \
    --cc=alonz@nolaviz.org \
    --cc=linux-kernel@vger.kernel.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