Advertisement
lazyy

Untitled

May 8th, 2023
2,611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. using System;
  2. using System.Threading.Tasks;
  3.  
  4. class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. int numCores = Environment.ProcessorCount;
  9. Console.WriteLine($"Number of cores: {numCores}");
  10.  
  11. Parallel.For(0, numCores, i =>
  12. {
  13. while (true)
  14. {
  15. // Perform some heavy calculations
  16. double result = 0;
  17. for (int j = 0; j < 1000000; j++)
  18. {
  19. result += Math.Sqrt(j);
  20. }
  21. }
  22. });
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement