Java tutorial
//package com.java2s; //License from project: Apache License import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Main { /** * Create new executor with a thread for each processor core. * * @return A new executor with a thread for each processor core. */ public static ExecutorService allAvailableProcessors() { return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); } }