Is there a point to multithreading?

后端 未结 11 794
无人共我
无人共我 2021-01-02 17:22

I don’t want to make this subjective...

If I/O and other input/output-related bottlenecks are not of concern, then do we need to write multithreaded code? Theoreti

11条回答
  •  礼貌的吻别
    2021-01-02 17:58

    Much of the multithreading is done just to make the programming model easier when doing blocking operations while maintaining concurrency in the program - sometimes languages/libraries/apis give you little other choice, or alternatives makes the programming model too hard and error prone.

    Other than that the main benefit of multi threading is to take advantage of multiple CPUs/cores - one thread can only run at one processor/core at a time.

提交回复
热议问题