Main Thread + Thread Pool and CPU usage
If I build a console app and do a lot of thread pool work, and keep the console app alive using a single Console.ReadLine();
Will the app perform to its maximum in this case? Will the thread pool be able to consume as much CPU a开发者_StackOverflow社区s possible? Or do the Console.ReadLine hog the main thread in such a way that it steals CPU from the thread pool?
(I was under the assumption that ReadLine does not steal cpu time in a significan way, but according to JetBrains profiler, 60% of the CPU time is spent in my single ReadLine statement)
The computer is NOT using the on the Console.RealLine just look at the task manager.
But the main thread of your application is "hanging" on the Console.Readline, thats why the profiler reports it.
Its correct what you say it reports it as a hotspot, its because the main thread is spending a vast majority of the time on this function ( And the profiler assumes time spent = CPU used ).
精彩评论