using System; using System.Threading; using System.Diagnostics; namespace lab1 { class Program { static void Main() { int time = 1000000; while(true) { Thread th = new Thread(delegate () { Thread.Sleep(time); }); th.Start(); } } static void threads() { Stopwatch stopw = new Stopwatch(); stopw.Start(); int threadcount = 1000; for (int i = 0; i < threadcount; i++) { Thread th = new Thread(delegate () { }); th.Start(); th.Join(); } stopw.Stop(); Console.WriteLine(stopw.ElapsedMilliseconds + "ms"); Console.Read(); stopw.Reset(); } } }