[Mono-list] Parallel.ForEach & MaxDegreeOfParallelism

Karol karol.gwaj at skillpages.com
Thu Nov 22 13:54:05 UTC 2012


Hi Guys,

Im trying to use Parallel.ForEach with custom MaxDegreeOfParallelism
but looks like MaxDegreeOfParallelism parameter is ignored and by default
Parallel.ForEach is using threads count equal to number of processors

this same sample app works fine when running with microsoft .NET 4.0

My environment details:
 OS: ubuntu 12.04
 Mono: Mono JIT compiler version 2.10.8.1 


Example of code im running:

class Program
{
  static void Main(string[] args)
  {
                Parallel.ForEach(Enumerable.Repeat<int>(0, 10), new
ParallelOptions() { MaxDegreeOfParallelism = 100 }, i =>
                    {
                       
Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
                        Thread.Sleep(5000);
                    });
  }
}



i tried to set ThreadPool min and max threads count but it didnt helped
is there some other setting somewhere im missing that will remove upper
limit (max processors count) of tasks from Parallel.ForEach (when i set
MaxDegreeOfParallelism to smaller number than number of processors then it
is working fine)

Any help will be greatly appriciated
Cheers



--
View this message in context: http://mono.1490590.n4.nabble.com/Parallel-ForEach-MaxDegreeOfParallelism-tp4657494.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list