using System.Threading.Tasks;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Diagnostics;
public static void Main()
Console.WriteLine($"FrameworkDescription: {RuntimeInformation.FrameworkDescription}");
Console.WriteLine($"OSVersion: {Environment.OSVersion}");
Console.WriteLine($"Environment.ProcessorCount: {Environment.ProcessorCount}");
ThreadPool.SetMinThreads(workerThreads: 100, completionPortThreads: 10);
HashSet<Thread> threads = new();
Parallel.ForEach(Enumerable.Range(1, 1500), n =>
lock (threads) maxConcurrency = Math.Max(maxConcurrency, ++concurrency);
lock (threads) threads.Add(Thread.CurrentThread);
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < 200) { }
lock (threads) --concurrency;
Console.WriteLine($"Number of unique threads: {threads.Count}");
Console.WriteLine($"Maximum concurrency: {maxConcurrency}");