From owner-freebsd-hackers Tue Jan 30 12:30:50 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id CC41537B65D for ; Tue, 30 Jan 2001 12:30:31 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0UKUSC07948; Tue, 30 Jan 2001 12:30:28 -0800 (PST) Date: Tue, 30 Jan 2001 12:30:28 -0800 From: "'Alfred Perlstein'" To: Kevin Mills Cc: Jeff Roberson , "'freebsd-hackers@freebsd.org'" Subject: Re: Kevents/libc_r ? Message-ID: <20010130123028.W26076@fw.wintelcom.net> References: <31E4B6337A4FD411BD45000102472E0C05E74D@EMAIL_SERVER> <85puh4stjt.fsf@diablo.in.a6l.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <85puh4stjt.fsf@diablo.in.a6l.net>; from kmills@a6l.net on Tue, Jan 30, 2001 at 11:56:22AM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Kevin Mills [010130 11:56] wrote: > "Jeff Roberson" writes: > > > Is that true in -CURRENT as well? It looks to me like it calls kevents with > > a 0 timespec and then calls into the scheduler. > > > > > * Jeff Roberson [010130 11:05] wrote: > > > > Does anyone know if it's safe to use kevents with pthreads yet? I poked > > > > around and saw that it is handled in libc_r/uthread, but I also noticed > > that > > > > my process that should be waiting in kqread is actually waiting in poll. > > If > > > > I remove -pthread from the compile line it waits in kqread again! Is > > > > pthreads just using poll for timeouts? > > > > > > pthreads puts the kevent into the array of pollfds that it uses to > > > do non-blocking operations. > > Wait a second here... what does this mean? Am I reading that when using > non-blocking sockets and kevent with -pthread I'm actually using poll? > > Please explain - I'm trying to get away from poll! Since the kevent descriptor is put on the pollfd array, you are still using poll(2) however, if you store all your events on a single kqueue you will only need to poll it, and not tens/hundreds/thousands of fds, just that one fd. So there is a tad of overhead, but it should scale. Basically, each event on the kevent gets stored into the kevent, it's the kevent descriptor that is poll(2)'d, not each descriptor put into the kevent. Hope this is clear. Also, patches to make libc_r use kevent instead of poll would be welcome. :) -- -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-hackers" in the body of the message