[Mono-list] Parallel.ForEach & MaxDegreeOfParallelism

Daniel Lo Nigro lists at dan.cx
Fri Nov 23 01:06:39 UTC 2012


This number is also publicly documented though, you don't need to decompile
the code to find it. :P

http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.maximumconcurrencylevel.aspx
Returns an integer that represents the maximum concurrency level. *The
default scheduler returns Int32.MaxValue.*

To get the same behaviour as the .NET runtime, you may be able to create
your own class that extends TaskScheduler and override the
MaximumConcurrencyLevel property.


On Fri, Nov 23, 2012 at 7:00 AM, Stifu <stifu at free.fr> wrote:

> You're aware we're not supposed to look into the .NET code, because then
> that
> prevents us from contributing to Mono, yes?
> Because of you, I guess I cannot contribute to Mono anymore. :p
>
>
> Karol wrote
> > ok i found solution to this problem
> >
> > after digging a little with ILSpy i found out that there is difference in
> > implementation of TaskScheduler.MaximumConcurrencyLevel between MS.NETand
> > Mono:
> >
> > MS.NET :
> > public virtual int MaximumConcurrencyLevel
> > {
> >       get
> >       {
> >               return 2147483647;
> >       }
> > }
> >
> >
> > MONO:
> > public virtual int MaximumConcurrencyLevel
> > {
> >       get
> >       {
> >                    return Environment.ProcessorCount;
> >       }
> > }
> >
> >
> > (this difference was making my app work like 10 times slower on Mono than
> > it was on MS.NET)
> >
> > i dont know if this should be considered a bug ?
> > i think portability of .NET code between windows and other OS'es should
> be
> > threated as main feature of Mono
>
>
>
>
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/Parallel-ForEach-MaxDegreeOfParallelism-tp4657494p4657496.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20121123/48d22d6f/attachment.html>


More information about the Mono-list mailing list