I've been doing some tests about the way a .NET C# application uses resources, like CPU or memory. I wrote some loops that calculate values for a large amount of numbers and I'm satisfied with the weight of the algorithm.
I have a Quad Core 2.4 GHz processor, but I've noticed that In Task Manager, my application is only using 25% of my CPU. Why isn't it using 100%? Does that mean that a .NET C# Application compiled in VS 2008 only supports Single Core CPU? Or is there a way that I can force it to use all CPUs?
It all depends on how you can modify your code to use more than one core.
Unless you are doing parallel or multi threaded operations, then the programme won't use more than one core.
.NET 4 has a library that can help you: Parallel LINQ. For more information see this page: http://msdn.microsoft.com/en-us/library/dd997425.aspx
It will run at 1 core unless you specifically start some threading.
The easiest way is to push a method onto the ThreadPool.
System.Threading.ThreadPool.QueueUserWorkItem(DoSomething);
void DoSomething() { ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With