amazingIndustry
Registered: Aug 2009
Posts: 570 |
05-07-12 01:40 AM
Re .Net there are plenty public sites out there that published performance results that show that task switching and generally running light-weight work on tasks rather than generating threads is always advantageous in terms of resource allocation and computational efficiency. I am not sure about the term "fibers" and thus cannot comment but my understanding of "coroutines" is a concept that was implemented through the arrival of task programming (at least in .Net). Note that most coroutine libraries date back to 2002-2003 when .Net was at 2.0.
It is very easy for anyone to run a performance comparison by starting up n-number threads and have them operate as worker threads and then trying to solve the same problem using tasks. The new Async CTP framework is terrific because it is very logical and the beauty of it is that it requires minimal code changes though I always recommend to think parallelism/concurrency at design time, its not optimal to try to squeeze sequential code into a concurrent framework through code changes.
Quote from rufus_4000:
Ok, I will bite. Those who know me knows that I am not a .NET person by any means. But for a large number of concurrent lightweight threads (with the computing threads and I guess the arbitrage opportunity seeking threads), I would think some language constructs like "coroutines" maybe close to the desired goal. I am currently using a customized version of coroutines (libpcl with stack jumps for anyone that cares) along with my thread pool library in production platform, and it has yielded significant performance improvements (over simple "green-ish" threads). I believe MSFT calls coroutines "Fibers" under the .NET, but that's about the extent of my knowledge there.
For those of you who are not familiar with coroutines (other than the original Don Knuth's definition), lookup the Wikipedia entry. I think of it as a concurrency semantics free (as concurrency is implied in the "Yield" operation) cooperative execution, which, incidentally (!), works quite well for data processing, analytics generating, etc.
|