Using System.Threading.Tasks.Parallel create new thread in the thread pool?

前端 未结 4 619
慢半拍i
慢半拍i 2021-02-06 11:45

Maybe I did not understand it right ... all the Parallel class issue :(

But from what I am reading now, I understand that when I use the Parallel I actually mobilize

4条回答
  •  离开以前
    2021-02-06 12:29

    Parallel.Foreach does not create new threads, nor does it "mobilize all the threads". It uses a limited number of threads from the threadpool and submits tasks to them for parallel execution. In the current implementation the default is to use one thread per core.

提交回复
热议问题