Can you limit the processing resources that the application can use in .NET.

I would like to write a .NET application that runs in the background (remains on the taskbar) and performs a long operation, for example, copying file folders from one place to another. I want to write it in such a way that other running applications do not slow down much. I don't care how long the background application takes. Is there a way to limit processing / memory resources for an application. I know when you create topics, you can set priorities at different levels. Does this downstream priority set this effect or will it have lower priority than any other threads entering the same application?

+4
source share
2 answers

If you are looking for something with NICE precision in unix, I'm not sure if it exists. But you can prioritize a process that can help.

System.Diagnostics.Process.GetCurrentProcess().PriorityClass =System.Diagnostics.ProcessPriorityClass.Low; 

Hope this helps.

+1
source

Yes, you can create a new Thread and set the Priority property before starting it:

 Thread thread = new Thread(MethodToRun); thread.Priority = ThreadPriority.Lowest; thread.Start(); 
+3
source

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


All Articles