Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 2000 09:42:35 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Dan Kegel <dank@alumni.caltech.edu>
Cc:        Alan Cox <alan@lxorguk.ukuu.org.uk>, Jonathan Lemon <jlemon@flugsvamp.com>, Gideon Glass <gid@cisco.com>, Simon Kirby <sim@stormix.com>, chat@FreeBSD.ORG, linux-kernel@vger.kernel.org
Subject:   Re: kqueue microbenchmark results
Message-ID:  <20001027094235.C28123@fw.wintelcom.net>
In-Reply-To: <39F9AB95.735E26A7@alumni.caltech.edu>; from dank@alumni.caltech.edu on Fri, Oct 27, 2000 at 09:21:41AM -0700
References:  <E13oyOE-00044z-00@the-village.bc.nu> <39F9AB95.735E26A7@alumni.caltech.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

* Dan Kegel <dank@alumni.caltech.edu> [001027 09:40] wrote:
> Alan Cox wrote:
> > > > kqueue currently does this; a close() on an fd will remove any pending
> > > > events from the queues that they are on which correspond to that fd.
> > > 
> > > the application of a close event.  What can I say, "the fd formerly known
> > > as X" is now gone?  It would be incorrect to say that "fd X was closed",
> > > since X no longer refers to anything, and the application may have reused
> > > that fd for another file.
> > 
> > Which is precisely why you need to know where in the chain of events this
> > happened. Otherwise if I see
> > 
> >         'read on fd 5'
> >         'read on fd 5'
> > 
> > How do I know which read is for which fd in the multithreaded case
> 
> That can't happen, can it?  Let's say the following happens:
>    close(5)
>    accept() = 5
>    call kevent() and rebind fd 5
> The 'close(5)' would remove the old fd 5 events.  Therefore,
> any fd 5 events you see returned from kevent are for the new fd 5.
> 
> (I suspect it helps that kevent() is both the only way to
> bind events and the only way to pick them up; makes it harder
> for one thread to sneak a new fd into the event list without
> the thread calling kevent() noticing.)

Yes, that's how it does and should work.  Noticing the close()
should be done via thread communication/IPC not stuck into
kqueue.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001027094235.C28123>