adjust threads number according to cpu cores