1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
// written by kutay zorlu // when you INCREASE count of threads it is decreasing performce of prosess using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace zip___test { class Program { public static Thread[] MyThreads = new Thread[10]; public static Name_creator[] asd = new Name_creator[10]; public int a = 0; public static int Main(string[] args) { Name_creator me = new Name_creator(); for (int I = 0; I < 10; I++){ //MyThreads[I] = new Thread(new ThreadStart(me.MyThreadProc)); // Thread Sayısı artıkdca performans azalıyor //MyThreads[I] = new Thread(new ThreadStart()); MyThreads[I] = new Thread(new ThreadStart( me.ThreadProc)); MyThreads[I].Start(); } Console.Write("Zips starting "); Console.ReadKey(); return 1; } public static void ThreadProc() { for (int i = 0; i < 100; i++) { Console.WriteLine("Kutay : "+i+"\n"); } } } class Name_creator { zip___test.Program asd = new Program(); string date = DateTime.Now.ToString(); public Name_creator() { date += date+"_KZ"; } public void ThreadProc() { for (int i = 0; i < 10000; i++) { asd.a++; Console.WriteLine("date: " +date+"Kutay : " + i + "\n"+asd.a); }// 45 saniyeye } } } |