Question: Question about Threads

I'm running calculations like this:

    N:=10000;
    f := (i,j)-> (some complicated procedure depending on i and j);
    M:= Matrix([Threads:-Seq([Threads:-Seq( f(i,j), j=1..N)], i=1..N)]);

I have a server with 20 cores, but each core has two threads, so this code should max out all 40 threads. But what I notice is only at most 20 threads being used at a time. 

I checked kernelopts(numcpus) returns 20. 

Does anyone have any advice on how to maximize my resource usage?

Please Wait...