i have file composed of 4 millions sets. every set contains 1 n words. size of file 120 mb. set1 = {w11, w12,...,w1i} set2 = {w21, w22,...,w2j} ... setm = {wm1, wm2,...,wmk} i want compute intersection between sets. set 1 ∩ {set1,...,setm} set 2 ∩ {set1,...,setm} ... set m ∩ {set1,...,setm} every operation takes around 1.2 seconds. did following: divide 4 million sets 6 chunks. every chunk containing 666666 sets then following. in here i'll creating 36 threads , i'll computing intersection between chuncks. slow , complicated problem. vector<thread> threads; for(int = 0; i< chunk.size();i++) { for(int j = 0; j < chunk.size();j++) { threads.push_back(thread(&transform::call_intersection, this, ref(chunk[i]),ref(tmp[j]), chunk(results))); } } for(auto &t : threads){ t.join(); } do have idea on how divide problem sub-problems , join of them in end. way in linux too? sample the first column represents id...