Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Oct 2004 14:37:57 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Igor Sysoev <is@rambler-co.ru>
Cc:        "Ronald F. Guilmette" <rfg@monkeys.com>
Subject:   Re: aio_connect ?
Message-ID:  <4176DAB5.5020302@elischer.org>
In-Reply-To: <20041020233952.V17688@is.park.rambler.ru>
References:  <49035.1098044385@monkeys.com> <20041020233952.V17688@is.park.rambler.ru>

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


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"
>  
>



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