Answer the question
In order to leave comments, you need to log in
What is the best way to use multithreading?
Let's say there are 4 cores in the resources. What is the best way to organize the work of two different multi-threaded programs: run each on two threads or four? Do OSes know how to properly optimize the operation of such a case, or is it impossible to do without interruptions and is it better not to bother with this and run each program with maximum threads?
Answer the question
In order to leave comments, you need to log in
In theory:
- if programs constantly eat resources without waiting for external data - it's better to scatter them over different cores.
- if one, then the other may be idle, or may want as much as the processor can give - for all cores.
Well, do not forget that the system will also run on something, and if it is Windows, then it will not let the cores get bored doing the same task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question