V
V
VZVZ2016-04-06 04:28:26
Iron
VZVZ, 2016-04-06 04:28:26

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++)
{
...
}

on a 2-core CPU, it will take not 50% at all, but under 100; on a 4-core, not 25%, but again under 100, thus, iron + OS automatically provide the maximum performance of the current (primary) task. Does what a programmer usually has to do manually.
Where is this used?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Antony, 2016-04-06
@RiseOfDeath

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.

V
Vladimir, 2016-04-06
@MechanID

Iron will not do such magic.

M
Maxim Moseychuk, 2016-04-06
@fshp

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.

G
GavriKos, 2016-04-06
@GavriKos

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 question

Ask a Question

731 491 924 answers to any question