When should you use multithreading? And would multi threading be beneficial if the different threads execute mutually independent tasks?

后端 未结 9 1105
生来不讨喜
生来不讨喜 2020-12-23 09:06

This were the only two questions I couldn\'t answer in the interview I got rejected from last night.

9条回答
  •  天涯浪人
    2020-12-23 09:59

    You can use multithreading if the tasks can be broken down which can be executed in parallel. Like produce and consume , Validate and save , Read and Validate.

    For the second question , Yes, it is beneficial for make a program into Multi threading if they are executing independent tasks.

提交回复
热议问题