Hello world application uses 4 threads in .NET4.0, but 3 in .NET2.0

When starting the main "Hello, World!" An application compiled for .NET2.0, you should see 3 threads (Main, GC and Finalizer). However, when creating .NET4.0, this number increases to 4 with the same base application. Does anyone know why an extra stream is needed?

+6
source share
1 answer

The default thread pool remains an inactive thread since .NET4 (as MSDN points to it ). I cannot find how their number is indicated (although you can change it using SetMinThreads), probably it is not.

This dotNetPerls article assumes that it also depends on the number of cores on the machine (which makes sense).

You can check ThreadPool.GetMinThreads () from both CLRs on your machine / specific program.

0
source

Source: https://habr.com/ru/post/909098/


All Articles