How to control the number of parallel processes with .par in Scala? -


i using par.map expression execute processes in parallel in scala (sbt).

consider list.par.map(function(_)) (i preparing mwe). means function(_) should applied elements of list in parallel fashion. in example, list has 3 elements. scala executes function(list(1)) , function(list(2)) in parallel, , afterwards function(list(3)).

is there reason behaviour? there relation fact programme executed on two-core processor? or how impose execute 3 things in parallel?

this question has been asked before:

and documented:

what want like:

var parallellist = list.par parallellist.tasksupport = new forkjointasksupport(      new scala.concurrent.forkjoin.forkjoinpool(parlevel)) parallellist.map(function(_)) 

that said if running on 2 core processor have 2 threads (unless cores hyper threaded of course) meaning can't have more 2 parallel operations @ once.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -