代码改变世界

高并发模拟( 测试 )

2011-05-20 18:07  yuejianjun  阅读(1215)  评论(0编辑  收藏  举报

http://www.cnblogs.com/ybhcolin/archive/2011/05/20/2052222.html 

以上代码.如果在高并发下会产生什么问题,开启1000个线程来模拟高并发

 

View Code
 1  static void Main(string[] args)
 2         {
 3             for (int i = 0; i < 1000; i++)
 4             {
 5                 System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(Logs.WriteLine));
 6                 t.Name = "线程" + i.ToString();
 7                 t.Start();
 8             }
 9             Console.Read();
10         }