Answer the question
In order to leave comments, you need to log in
Are there platforms where all tasks are automatically parallelized across CPU cores, and there is no need to create threads in the code?
That is, this is the code:
for (var i = 0; i < 1000000000; i++)
{
...
}
Answer the question
In order to leave comments, you need to log in
Hardware (and even OS) cannot know whether it is possible to execute such and such pieces of your program in parallel or not. The program either must be compiled for this right away, or some intermediate bytecode is needed, which will be "finished" before execution.
In general, such a problem cannot be solved.
But you can parallelize some types of operations on a data set, but this imposes a number of restrictions on the function.
Examples: OpenMP, GPU Shaders.
In fact, this is possible, only a little in the opposite direction. Iron determines that one core is overloaded, while the rest are idle, and part of the power of the remaining cores is transferred to the loaded core. In my opinion, modern processors do just that (server). Only not completely the core is thrown, but some part.
And the algorithm remains absolutely single-threaded.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question