tailieunhanh - Introducing dot NET 4 0 with Visual Studio_1

Tham khảo tài liệu 'introducing dot net 4 0 with visual studio_1', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 5 PARALLELIZATION AND THREADING ENHANCEMENTS factorials or walk trees of data but I think this distracts at least initially from understanding the basics. If you want to work with a more realistic example take a look at the examples from the parallel team you will find excellent ray tracing and other math related examples. Note that calling the method will involve a context switch an expensive operation for the CPU so it might slow the sample application down more than performing work might have. 1. Create a new console application called add the following using directives using using 2. Amend to the following code class Program . . public static List StockQuote Stocks new List StockQuote static void Main string args . double serialSeconds 0 double parallelSeconds 0 Stopwatch sw new Stopwatch PopulateStockList sw RunInSerial serialSeconds sw RunInParallel parallelSeconds Finished serial at 0 and took 1 serialSeconds Finished parallel at 0 and took 1 parallelSeconds private static void PopulateStockList new StockQuote ID 1 new StockQuote ID 2 new StockQuote ID 3 new StockQuote ID 4 new StockQuote ID 5 new StockQuote ID 6 Company Microsoft Price Company IBM Price Company Yahoo Price Company Google Price Company Altavista Price Company Ask Price 102 CHAPTER 5 PARALLELIZATION AND THREADING ENHANCEMENTS new StockQuote ID 7 Company Amazon Price new StockQuote ID 8 Company HSBC Price new StockQuote ID 9 Company Barclays Price new StockQuote ID 10 Company Gilette Price private static void RunInSerial for int i 0 i i 7 . . .

TỪ KHÓA LIÊN QUAN