From owner-freebsd-net Tue Mar 13 22:39:41 2001 Delivered-To: freebsd-net@freebsd.org Received: from info.iet.unipi.it (info.iet.unipi.it [131.114.9.184]) by hub.freebsd.org (Postfix) with ESMTP id C831737B719 for ; Tue, 13 Mar 2001 22:39:36 -0800 (PST) (envelope-from luigi@info.iet.unipi.it) Received: (from luigi@localhost) by info.iet.unipi.it (8.9.3/8.9.3) id HAA14416; Wed, 14 Mar 2001 07:39:51 +0100 (CET) (envelope-from luigi) From: Luigi Rizzo Message-Id: <200103140639.HAA14416@info.iet.unipi.it> Subject: Re: Changing UDP select() behavior In-Reply-To: <3AAEBEAE.F823CB8E@isi.edu> from Lars Eggert at "Mar 13, 2001 04:43:26 pm" To: Lars Eggert Date: Wed, 14 Mar 2001 07:39:50 +0100 (CET) Cc: net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Hi, > > I'm wondering if anyone has ever considered modifying the UDP behavior with > regard to selecting: > > Currently, writing to a UDP socket either enqueues packets in the interface > queue (returning success), or drops them on the floor (returning ENOBUFS) > if the queue is full. Selecting-to-write on a UDP socket always succeeds, > never blocks. I think it would require some substantial change to the network stack structure (basically to let your sockets sleep on an interface, and being woken up when the queue drains). There are fairness and efficiency issues here, because the device queue has so many "users" that the usual low-water/high-water strategy might cause a blocked socket to starve forever, so you might need to effectively block queueing if there are sockets sleeping on a queue, maybe issue a wakeup() on every single transmission when you have sockets waiting, and probably implement some ordering (maybe as simple as FIFO) for the waiting sockets. All in all I think this approach would only help a bit if if you were allowed to queue in the socket buffer (on which you can think of having some control, because you either opened the fd yourself or you inherited it from some parent), in addition to the device queue. cheers luigi > I'm considering changing this, so that a select-to-write on a UDP socket > will block until queue space becomes available. (I don't think this would > violate UDP semantics, but is a big enough change to warrant a new sockopt > to enable it.) > > Has this been considered/implemented in any OS? Does anyone see any serious > problems with it? Feedback greatly appreciated! > > Lars > -- > Lars Eggert Information Sciences Institute > http://www.isi.edu/larse/ University of Southern California Content-Description: S/MIME Cryptographic Signature [Attachment, skipping...] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message