I recently created a service that uses a single thread to periodically process information. The service was created using Microsoft Visual Studio 2010 Express. I noticed that the processor load took off on the moon (CPU load at 100%).
Later, out of curiosity, I built a very small program in which everything she does starts a small thread or timer, and then starts an incredibly long cycle. I also switched from creating a console application to a Windows Form application. I was able to reduce my problem by switching the type of program being created.
I tried to lower the priority of the stream:
System.Threading.Thread.CurrentThread.Priority = ThreadPriority.Lowest;
I also tried setting the priority class
Process p = Process.GetCurrentProcess();
p.PriorityClass = ProcessPriorityClass.BelowNormal;
I also thought that CPU usage could be high due to working in a virtual machine. But this theory did not lead me anywhere. This is pretty funny. I don’t know where else to turn. I'm not sure why starting a timer or thread would send my CPU usage through the ceiling just like in the .NET Framework. I have never experienced this when creating COM objects. Does anyone have any bright ideas on where I can go?
Thanks for your time in advance.
source
share