########################################################################### # # NAME: MThreadingDemo # # AUTHOR: SivaMulpuru # # COMMENT: This Program illustrates the advantage of using multithreading # # VERSION HISTORY: # 1.0 5/4/2011 – Initial release # ########################################################################### using System; using System.Threading; using System.Diagnostics; //for Stopwatch class Program { static void Main(string[] args) { Console.WriteLine("Processor Count is {0}\n", Environment.ProcessorCount); Stopwatch stopwatch = new Stopwatch(); Console.WriteLine("#################SingleThread####################"); stopwatch.Start(); Console.WriteLine("Fibonacci of {0} is {1}", 40, Fibonacci(40).ToString()); Console.WriteLine("Fibonacci of {0} is {1}", 41, Fibonacci(41).ToString()); stopwatch.Stop(); Console.WriteLine("Time taken for Fibonacci of {0} and {1} asynchronously is {2} secs", 40, 41, stopwatch.ElapsedMilliseconds / 1000); Console.WriteLine("#################SingleThreadEnd#################\n"); Console.WriteLine("#################TwoThreads####################"); int[] x = new int[2]; Thread[] threads = new Thread[2]; x[0] = 40; x[1] = 41; stopwatch.Restart(); …