I am using the par.map
expression to execute processes in parallel in Scala (SBT).
Consider list.par.map(function(_))
(I am preparing an MWE). This means that function(_)
should be applied to all the elements of the list
in a parallel fashion. In my example, list
has 3 elements. But Scala executes only function(list(1))
and function(list(2))
in parallel, and only afterwards function(list(3))
.
Is there a reason for this behaviour? Is there a relation with the fact that the programme is executed on a two-core processor? Or how could you impose to execute all three things in parallel?