8

面试官:线程池里面到底该设置多少个线程?-wx5d30212829a35的博客

 3 years ago
source link: https://blog.51cto.com/14455981/2498674
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
一、抛出问题关于如何计算并发线程数,一般分两派,来自两本书,且都是好书,到底哪个是对的?问题追踪后,整理如下:第一派:《Java Concurrency in Practice》即《java并发编程实践》,如下图:如上图,在《Java Concurrency in Practice》一书中,给出了估算线程池大小的公式:Nthreads=Ncpu*Ucpu*(1+w/c),其中Ncpu=CPU核心数

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK