Multithreading learning limits the number of threads running at the same time

Source: Internet
Author: User

In my spare time, I have been engaged in multi-thread learning. I only want to prepare for the next project. With the optimization, development, and performance considerations of the project, I will gradually use something that I didn't need before and get familiar with first.

Let's put things up first. You are welcome to give us some advice. It has been a long time for us to play with things, and it is definitely not perfect. I hope you can give us some valuable comments (~~)

 

Approximate Function Description: In order to improve data processing speed, the task queue is handed over to different sub-threads to complete, and the number of new threads to be started is limited, so that too many threads can be regarded as machine shells.

 

                   NowThCount = ;           MaxThCount = ;           RunNum = ;                           (                                    (NowThCount ==  && RunNum ==                                                                          (RunNum ==  && NowThCount !=                       Thread.Sleep();                     ;                                     (NowThCount >=                      Thread.Sleep();                     ;                                     (RunNum >  && NowThCount <                                           RunNum--                      NewTh =  Thread(                Console.WriteLine(+                         NowThCount++;              Console.WriteLine( +             Thread.Sleep(             Console.WriteLine( + Thread.CurrentThread.ManagedThreadId +               NowThCount--;   }

 

 

Written at the end: I feel that the program is not perfect, will it become abnormal due to special reasons during running, and will it still be in testing .....

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.