Task Parallel library implementation on mono?
Does Mono implement Task Parallel library? If so,开发者_如何学编程 how does performance compare between .NET and mono.
This was implemented in Mono release 2.6.
From the release notes:
ParallelFx
This release includes some components of the ParallelFx framework that were developed as part of Google Summer Of Code 2008 & 2009. More precisely, it contains the Task Parallel Library and Data Structures For Coordination.
Using ParallelFx, you can easily develop software that can automatically take advantage of the parallel potential of today multicore machines. For that purpose, several new constructs like futures, parallel loops or concurrent collections are now available.
To use this code you have to manually enable the .NET 4 profile using the --with-profile4=yes switch at configure stage.
In my own experience, I have a highly parallel program in C# for the learning and classification of gene sequence data which makes very heavy usage of the Task Parallel Library features such as Parallel.ForEach, Parallel.For, Task.Factory.StartNew(), and many structures from from the Collections.Concurrent namespace (Blocking Collections, Concurrent Dictionaries, Concurrent Bags etc). In short, my application's performance on Linux using mono is many many times slower. I am still trying to figure this out. I can run it from the mono console in windows with similar performance.
I have experimented with using mono's sgen garbage collector to no avail. The performance of my application on a Linux server running with mono is still dramatically slower.
Learning 8,258 sequences: 0:17 vs. 1:59 m:ss on Linux
Classify 921 sequences: 2.29 seconds vs. 11:05 mm:ss on Linux
See screen shots below.
Did you try changing the min/maxthreads?
System.Threading.ThreadPool.SetMaxThreads(mWorker, mWorker);
System.Threading.ThreadPool.SetMinThreads(10, 10);
You are operating way beyond me, but I found that nothing was getting done. So I set it to 5 * number of cpu cores and it snapped right out of it!
精彩评论