It is very clear that with task as async / await Instead of calling the asynchronous call threads , my question is: Is there a way to monitor threads while completing these tasks? This is because I can decide an optimal number of times for the thread that the thread does not eat too many CPU cycles at the same time (the CPU is intensive to handle the work). We take an example below (output is also mentioned) Although the program is completed in 5 seconds, but it has two threads (id = 1,4 ) if I increase the number of 6 instead of 2, then it creates 4 threads I know that this is the CLR thread OS thread (which is 4 in my machine Are), but I would like to know how they are mapped O (with actions) and use the same CPU. Is there any way to get it? Test code Fixed zero main (string [] args) {RunTasksWithDelays (). ); } Static async Task Run Task with Dislay () {Stopwatch S = Stopwatch. Startup (); Console.light line ("thread id =" + thread.content.trade.manag...
Comments
Post a Comment