Home > Article > Backend Development > Why Does Windows 10 Create Additional Threads When Running a Simple Program?
Despite the simplicity of a test program with a single main thread, Windows 10 unexpectedly initiates several additional threads. This issue raises the question of who or how these threads are initiated.
Identifying the Threads
The Debug > Windows > Threads window reveals the presence of these threads at ntdll.dll!TppWorkerThread. These are thread-pool threads, as evident from setting a breakpoint on the TppWorkerThread() function.
Root Cause: DLL Loading
The stack trace for the first threadpool thread when the second threadpool thread starts executing shows that the loader is invoking the threadpool to load DLLs. This is a notable change from Windows 7, where DLLs were loaded without using the threadpool.
Windows 10 Optimization
Windows 10 utilizes multiple cores to accelerate process initialization by leveraging the threadpool for DLL loading. This concurrency mechanism improves performance and is not considered a bug but rather a feature to take advantage of modern hardware capabilities.
The above is the detailed content of Why Does Windows 10 Create Additional Threads When Running a Simple Program?. For more information, please follow other related articles on the PHP Chinese website!