multithread permutation generation