C # thread base Thread Pool

Source: Internet
Author: User

The thread pool can better control the running status of a series of threads. Msdn reference

Http://msdn.microsoft.com/zh-cn/library/3dasc8as (vs.80). aspx

Here, Ms clearly describes threadpool, but its example is too simple. It just briefly introduces how to use a semaphore array to control the members of the thread pool. A better example is provided in the Introduction Document of threadpool. getmaxthreads.

Http://msdn.microsoft.com/zh-cn/library/system.threading.threadpool.getmaxthreads (vs.80). aspx

This example is difficult for beginners who have not been deeply involved in reading and writing threads or files, but I suggest you try to figure out each line of code in it. This example shows that an auxiliary thread is called manually, and two Io threads are called asynchronously through filestream. "And according to the speed and number of computer processors, write operations are processed by one or two port threads"
The two filewriter. beginwrite are called in turn and will be queued in the thread pool. If there are not enough Io threads, the two may not necessarily be concurrent.

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.