Does the new thread pool in .net 4.0 rely on the windows scheduler or does it integrate in some way to take control?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The .NET thread pool is essentially a pool of threads that can be shared to execute tasks, process asynchronous I/O and provide timers. The “objects” in the pool are .NET threads and these are implemented using Windows threads. So when the thread pool executes a task on a thread it executes on a Windows thread.
In general a process will contain several threads and some of these threads may belong to the thread pool. When these threads execute concurrently the Windows scheduler is in charge of scheduling the threads to execute on CPU cores by using context switching.
The .NET 4 thread pool does not schedule threads that are executing. However, task that have been queued for work in the thread pool will eventually be assigned to a thread in the thread pool. When the task is complete (this could take 1 ms or 1 year) the thread is recycled to the thread pool. The thread pool can expand and contract to optimize how system resources are used.
You can read a blog entry about what improvements were made to the the .NET 4.0 thread pool: ThreadPool Improvements by Eric Eilebrecht.