Home  >  Article  >  Backend Development  >  Why Does Windows 10 Create Additional Threads When Running a Simple Program?

Why Does Windows 10 Create Additional Threads When Running a Simple Program?

Susan Sarandon
Susan SarandonOriginal
2024-10-26 12:19:29990browse

Why Does Windows 10 Create Additional Threads When Running a Simple Program?

Identifying the Source of Additional Threads in Windows 10

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn