Skip to main content

How does the .NET ThreadPool actually schedule work?

Expert C#
Quick Answer The ThreadPool maintains a global queue and per-thread local queues. Threads steal work from each other when idle. A hill-climbing algorithm adjusts the thread count based on throughput measurements. For long-running work (> 0.5s), use TaskCreationOptions.LongRunning to get a dedicated thread instead.

Answer

Uses global + per-thread queues, work-stealing, and hill-climbing algorithm to adjust worker count.

Long-running work should use TaskCreationOptions.LongRunning.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice