Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feed.news.qwest.net!mpls-nntp-01.inet.qwest.net!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: NIO multiplexing + thread pooling Date: Fri, 30 Sep 2011 07:46:45 -0700 (PDT) Organization: http://groups.google.com Lines: 21 Message-ID: <2026012.1217.1317394005581.JavaMail.geo-discussion-forums@prfc6> References: <9e8aqfFnorU1@mid.individual.net> <9efsnrFoviU1@mid.individual.net> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 24.6.43.78 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1317394129 21180 127.0.0.1 (30 Sep 2011 14:48:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 30 Sep 2011 14:48:49 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.6.43.78; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8412 markspace wrote: > Peter Duniho wrote: >> I don't have specific numbers. But I can tell you that synchronization >> overhead, and in particular the cost of a thread context switch, is one >> of the reasons that i/o completion ports on Windows is such a critical >> technique for scalable networking processes. > > Interesting.... > > Context switching is a different issue from synchronization. Context switches happen even in non-critical sections, where synchronization does not apply. This does not invalidate the rest of Pete's points since they emanate from the cost of context switching, which is actually more frequent and a more impactful phenomenon than synchronization. So in the simple-minded case where a separate single thread handles each connection there is possibly no synchronization at all between the threads, but context switching still militates against this technique for too many concurrent connections. OTOH, choice of operating system and hardware can influence this equation. For example, the QNX operating system on Intel/AMD is famously fast at context switches. -- Lew