Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- class Program
- {
- static void Main(string[] args)
- {
- int numCores = Environment.ProcessorCount;
- Console.WriteLine($"Number of cores: {numCores}");
- Parallel.For(0, numCores, i =>
- {
- while (true)
- {
- // Perform some heavy calculations
- double result = 0;
- for (int j = 0; j < 1000000; j++)
- {
- result += Math.Sqrt(j);
- }
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement