I'm currently using the Parallel Extensions that are part of Reactive Extensions for .Net(Rx). I believe they are also available through .Net 4 beta releases.
1) Is there any way to determine how many threads are actually being utilized. I assume this is related to Environment.ProcessorCount
(# of logical cores) but I want to check this.
2) Is there any way of configuring how many thread you wish to use? I noticed there is a ParallelOptions.MaxDegreeOfParallelism
property that looks promising but it appears to default to -1 (no limit to the number of threads) and I'm also not quite sure if this can be set once for the current application, as opposed to being passed in to each call to Parallel.For()
, etc.
UPDATE: This option appeared in .Net 4; ParallelOptions.MaxDegreeOfParallelism
In answer to my own question, the answer appears to simply be - No. The number of threads/cores used doesn't appear to be configurable.