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

Q: When should you use multithreading?

A: “Your question is very broad. There are few non-trivial systems where the functionality can be met simply, quickly and reliably with only one thread. For example: [pick out a typical system that the target company sells and pick out a couple aspects of its function that would be better threaded off – heavy CPU, comms, multi-user – just pick out something likely & explain].

Q: Would multithreading be beneficial if the different threads execute mutually independent tasks?

A: “Depends on what you mean by ‘executing tasks’. Multithreading would surely be beneficial if the threads process mutually independent data in a concurrent fashion – it reduces requirements for locks and probabilty of deadlocks increases in a super-linear fashion with the number of locks. OTOH, there is no issue with threads executing the same code, this is safe and very common.”

Leave a Comment