I have been experimenting a lot with application profiling lately (using the Visual Studio Performance Wizard). While working with Concurrency indicators, I noticed that when launching an application with several threads (both background and front), the cross-kernel switching speed is quite high.
Knowing that, as a rule, a large number of firewall context switches can be detrimental to application performance, I would like to reduce it to a minimum.
What would be the possible ways to do this in a .NET application, besides minimizing the number of concurrent threads?
You can associate some of these threads with a single core. But you have to be extremely careful when doing this - as this can actually slow down performance by not allowing the CLR / OS to schedule threads in available kernels.
To do this, you can use the BeginThreadAffinity method to force the thread to remain attached to the identity of a particular processor or core.
In fact, it is unlikely that context switches will be detrimental to application performance.
~ 1-4 , / , . , , : , , .
, ( ), - , , .
- ~ 30-120 ( ).
, , - , . .
, ., BeginThreadAffinity : .NET , .
BeginThreadAffinity
:
[1] Concurrency[2] [3] , ?
Source: https://habr.com/ru/post/1756971/More articles:How to create transparent activity programmatically? - androidInstalling MSDN Local Help for Visual Studio 2010? - visual-studio-2010Creating an Editing Form Using ASP.Net MVC 2 Stands - c #ASP.NET MVC - filter, action for calling based on query string - asp.net-mvcApplication protection for the market - androidСоздание гиперссылки /HTML/ "Пожалуйста, предложите" в цикле в GWT? - javaMissing package properties files in war assembly - eclipsePass Array From C # COM Object to JavaScript? - javascriptAutomatic restart during installation - safariWCF Service VS IIS 7.0 VS IIS7.5 - memory-leaksAll Articles