Finding .NET Multithreading Nodes

Hey.

I have a .NET application that runs a parallel simulation. It scans the parameters, so each parameter has its own cycle Parallel.Foreach. I usually set max parallelism to one, but one of the loops, to preserve memory requirements, since each parameter can take more values ​​than I have available kernels (4).

The application is completely CPU bound and only does input / output at the end to output the results. I have only one data structure lock that captures the results, but it is accessed very rarely (once every few seconds). No matter how far I push parallelism (controlling max parallelism on the loops), I always get average CPU usage of around 50% (~ 2 cores).

I would like to know what interferes with higher CPU utilization. My hunch is this: 1) some call to .NET libraries that are synchronized, thus serializing the calls. 2) GC logging into the system to clean up resources (there is a lot of garbage created by the application).

Any ideas how to go about the investigation?

Many thanks.

+3
source share
1 answer

I think that debugging multithreaded questions always requires knowledge of the code details, so there is no general recipe. But I think GC is a very good first guess. You have already tried this:

http://msdn.microsoft.com/en-us/library/ms229357.aspx

, gcServer CPU (8 ).

+2

Source: https://habr.com/ru/post/1754120/


All Articles