Home > Back-end >  Multithreading, concurrent programming
Multithreading, concurrent programming

Time:10-30

Novice for help, excuse me:
Multithreading is complete multiple threads share one thing,
Or multiple threads to independently complete the same thing?

CodePudding user response:

This is associated with your business needs,

CodePudding user response:

See specific needs:
Scenario 1: (1) you have more than one customer service, for example, can be understood as multiple threads, a customer consultation will assign a different customer 1 to 1 service, can be understood as multiple threads to independently finish one thing
(2) scenario 2: such as boating, together equals two threads, paddle, respectively, but the objective is to advance the ship, can be understood as multiple threads to complete one thing together,
For multiple threads to independently finish one thing, usually in order to improve implementation is not degree and parallel processing ability,
Multiple threads to complete one thing, more is to improve the execution efficiency, and more effective use of multi-core, more typical scenario is a calculation can be decomposed multiple sub calculation, a multi-threaded calculation after merged into the final result,