dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.09k stars 4.7k forks source link

Documentation and code for Thread Pool #4023

Closed gabikliot closed 4 years ago

gabikliot commented 9 years ago

Where can I find the documentation and the code for the Thread Pool? Would the coreclr thread pool be different from the full CLR thread pool?

MattWhilden commented 9 years ago

Is there something specific you're looking for our trying to do? There's lots of things written about Threadpool on msdn and channel9.

Source here: https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/Threading/ThreadPool.cs

gabikliot commented 9 years ago

The things on msdn and channel9 are about full CLR thread pool, not the one in coreclr. I mainly wonder if there are any plans to do any changes in the coreclr thread pool? For example: 1) Make it more configurable: Allow to control in more details how the pool grows and shrinks. 2) Controlling the thread pool that is used by other framework libraries. For example, async socket calls are using io completion ports. It would be nice to have the ability to provide your own set of threads to be used there. Just like TPL allows to provide a custom scheduler, it would be nice to provide custom thread pool for some libraries.

The default .NET thread pool is very good in a lot of cases, but in some more advanced scenarios, when one writes an advanced platform like Orleans, having more control is a big advantage. For example, Java NIO allows one to customize its thread pool as well.

Such an advanced control can be done of course in a non breaking way, thus not raising any backward compatibility issues.

MattWhilden commented 9 years ago

I don't know of any planned work in this space. The CoreCLR threadpool has historically only needed to support scenarios for Silverlight and Windows Phone apps.

@ericeil is a good contact to discuss further.

stephentoub commented 4 years ago

Closing as an answered old question. Thanks.