[Mono-list] Parallel.ForEach & MaxDegreeOfParallelism
Karol
karol.gwaj at skillpages.com
Fri Nov 23 10:07:30 UTC 2012
yep, i didnt know that you mono developers cant look into MS.NET source code
:)
i just started playing with mono
anyway, I decided to write custom task scheduler to go around this problem,
but then i stepped on another bug:
https://bugzilla.xamarin.com/show_bug.cgi?id=8559
so after another workaround (wrapping my code into additional task) i was
able to make it work
I also observed that threads allocation is quite different in mono than
MS.NET
my app is using Parralel.ForEach to access internet resources, so it is
creating a lot o HttpWebRequests (which are using ThreadPool too). When i
set min and max thread pool size to 150 threads and then run
Parallel.ForEach with cincurrency level 100 it was working much slower on
mono (because threads were queuing in ThreadPool). Increasing min/max thread
pool size helped a little, but it was still slower than MS.NET. I was able
to get to this same performance only when i created my own thread pool in
TaskScheduler. So overall conclussion is that it is easy to starve threads
for core functionality when using parallel library with default task
scheduler :).
--
View this message in context: http://mono.1490590.n4.nabble.com/Parallel-ForEach-MaxDegreeOfParallelism-tp4657494p4657499.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list