From owner-freebsd-net@FreeBSD.ORG Wed Oct 20 21:37:57 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F17EA16A4CE for ; Wed, 20 Oct 2004 21:37:57 +0000 (GMT) Received: from mail.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id D705043D31 for ; Wed, 20 Oct 2004 21:37:57 +0000 (GMT) (envelope-from julian@elischer.org) Received: from elischer.org (julian.vicor-nb.com [208.206.78.97]) by mail.vicor-nb.com (Postfix) with ESMTP id BE6507A424; Wed, 20 Oct 2004 14:37:57 -0700 (PDT) Message-ID: <4176DAB5.5020302@elischer.org> Date: Wed, 20 Oct 2004 14:37:57 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030516 X-Accept-Language: en, hu MIME-Version: 1.0 To: Igor Sysoev References: <49035.1098044385@monkeys.com> <20041020233952.V17688@is.park.rambler.ru> In-Reply-To: <20041020233952.V17688@is.park.rambler.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-net@freebsd.org cc: "Ronald F. Guilmette" Subject: Re: aio_connect ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2004 21:37:58 -0000 Igor Sysoev wrote: >On Sun, 17 Oct 2004, Ronald F. Guilmette wrote: > > > >>I'm sitting here looking at that man pages for aio_read and aio_write, >>and the question occurs to me: ``Home come there is no such thing as >>an aio_connect function?'' >> >>There are clearly cases in which one would like to perform reads >>asynchronously, but likewise, there are cases where one might like >>to also perform socket connects asynchronously. So how come no >>aio_connect? >> >> > >In FreeBSD you can do connect() on the non-blocking socket, then set >the socket to a blocking mode, and post aio_read() or aio_write() >operations on the socket. > >FreeBSD allows to post AIO operaitons on non-connected socket. >NT (and W2K, I believe) do not. This is why ConnectEx() appeared in XP. >I do not know about other OSes, but I belive only FreeBSD and NT have >the kernel level AIO sockets implementation without the threads emulation >in the user level (Solaris) or without the quietly falling to synchronous >behaviour (Linux). > >While the developing my server nginx, I found the POSIX aio_* operations >uncomfortable. I do not mean a different programming style, I mean >the aio_read() and aio_write() drawbacks - they have no scatter-gather >capabilities (aio_readv/aio_writev) and they require too many syscalls. >E.g, the reading requires >*) 3 syscalls for ready data: aio_read(), aio_error(), aio_return() >*) 5 syscalls for non-ready data: aio_read(), aio_error(), > waiting for notification, then aio_error(), aio_return(), > or if timeout occuired - aio_cancel(), aio_error(). > >I think aio_* may be usefull for the zero-copy sockets, however, >FreeBSD's aio_write() does not wait when the data would be acknowledged >by peer and notifies the completion just after it pass the data to >the network layer. > Now that we have real threads, it shuld be possible to write an aio library that is implemented by having a bunch of underlying threads.. > > >Igor Sysoev >http://sysoev.ru/en/ >_______________________________________________ >freebsd-net@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-net >To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > >