c# - Parallel.For, max threads and cores -
on our server, got quad-core processor. when running parallel.for loop without paralleloptions parameter, how many threads utilize?
also, when running nested loops, should both outer , inner loops parallel or outer in terms of performance?
you can't know how many exactly, number of threads between 1
, n
, n
number of tasks run in parallel (one thread current thread of execution way, since parallel
waits tasks complete). parallel
not guarantee operations run concurrently however, may be. implement own task scheduler , use if want control on how many threads used.
if want know whether better run outer , inner loops in parallel, there no answer. don't know loops doing. use performance analyzer before trying optimize loops, since odds have no idea performance bottlenecks are.
Comments
Post a Comment