Using Parallel.For in TPL
Parallel.For( 0, 2048, n=> { output_data[n] = function(constant_input_data, n); });
TPL tries to create as many threads as not. from the processor cores that you have, and then your work is divided into tasks scheduled for these threads. So these are 2048 tasks, maybe not. threads where x is not. cores.
source share