Home > Back-end >  [the interview questions] a custom thread pool is how to determine the maximum number of threads to
[the interview questions] a custom thread pool is how to determine the maximum number of threads to

Time:09-16

CSDN blog said according to task is CPU intensive and IO intensive to distinguish, set the maximum number of threads to the core of the CPU number or its multiples? This book has introduced? You are in the actual project is how to determine?

CodePudding user response:

(the largest number of jobs - queue capacity)/each thread processing power=maximum number of threads per second

CodePudding user response:

Cpu-intensive task, the maximum number of threads & lt;=the number of available core CPU,
IO intensive tasks, the maximum number of threads and CPU core number is not a strong connection, according to the size of the quota and the performance of the server to set a value, if IO quota is an average of 100, the largest number of threads can be set to 120, if the average is a large amount of IO task, then, suggest to adjust the software architecture, using distributed to handle, the bottleneck is not what the thread pool,

CodePudding user response:

Java multi-thread programming have the introduction of practical guide to chapter 9

CodePudding user response:

"Concurrent Java programming of actual combat" classic books, learning multithreading is highly recommended
  • Related