Q
Q
qzark12019-04-22 19:57:45
Multithreading
qzark1, 2019-04-22 19:57:45

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

2 answer(s)
A
Adamos, 2019-04-22
@Adamos

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.

D
Dimonchik, 2019-04-22
@dimonchik2013

4
but generally selected empirically

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question