[Mono-list] Re: full duplex sockets and threads

P. Oscar Boykin oscar.boykin at gmail.com
Mon May 8 12:55:35 EDT 2006


Thanks for your reply.  Some more below...

On 5/8/06, Robert Jordan <robertj at gmx.net> wrote:
>
> P. Oscar Boykin wrote:
> > If anyone else has some good pointers on how to use one socket to send
> and
> > receive without polling or using the asynchronous methods I would be
> happy
> > to learn of them (polling introduces latency and the asynchronous
> methods
> > often lead to deadlocks I guess due to their internal use of
> threadpools).
>
> Supposing the reads & writes are highly interdependent, using
> asynchronous methods is the fastest way. Having separate threads
> for reading and writing needs thread synchronization and leads
> to a context switch.
>
> The async methods used by the Socket class are handled differently
> by the runtime. They are not invoked from the generic TP. The Socket
> IO is handled by a specialized thread using AIO APIs.


Is this really true?  I assume you mean posix aio methods?  When I look in
the mono source I can't find where this is happening.  Am I missing it?  It
appeared to me that the asynchronous methods were being implemented with
threading in mono and the standard synchronous socket calls.

Can you provide a reference (file names/line numbers) for the aio code in
mono?


> BTW, the TP issues have been fixed in the meanwhile:
>
> http://www.mono-project.com/Article:ThreadPool_Deadlocks
> (see "Long Term Solutions" )


Yeah I have seen that, but when I start many asynchronous calls (30-50)
between  many sockets in many different threads which are sending a lot of
data back and fourth, I get problems which I don't get if I work with
Socket.Poll (it appears some of the threads are deadlocked).  I know that's
a vague statement and not sufficient for a bug report, but I am still
dubious that the asynchronous code is robust enough to be used in my setting
(P2P code used in research).

Best Regards,
--
P. Oscar Boykin                            http://boykin.acis.ufl.edu
Assistant Professor, Department of Electrical and Computer Engineering
University of Florida
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20060508/29931ada/attachment.html


More information about the Mono-list mailing list