Number of Threads for an optimized thread pool

  • $N_{cpu}$ = Number of Available CPUs
  • $U_{cpu}$ = Target utilization of those CPUs (0 ⇐ $U_{cpu}$ ⇐ 1)
  • $W_c$ = Ratio of Wait time / Compute time

Following the formula: $ N_{threads} = N_{cpu} * U_{cpu} * (1 - W_c)$

You can determine the number of CPUs using Runtime:

int N_CPUS = Runtime.getRuntime().availableProcessors();
programming/java/thread_pool_size.txt · Last modified: 2017/02/05 17:43 (external edit)
Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0