Calculate the Optimum Number of Threads
Posted zhouj-happy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Calculate the Optimum Number of Threads相关的知识,希望对你有一定的参考价值。
cpu 密集性task,过多的线程反而降低了处理效率,最佳的做法就是保持和cpu core数量大致相同的线程数量:
threads = number of CPUs + 1
io密集型,因为会有cpu idel,增加线程数量,可以提高cpu的利用率。具体算法:
threads = number of cores * (1 + wait time / service time)
参考
http://baddotrobot.com/blog/2013/06/01/optimum-number-of-threads/
http://ifeve.com/how-to-calculate-threadpool-size/
https://justdo2008.iteye.com/blog/2291365
以上是关于Calculate the Optimum Number of Threads的主要内容,如果未能解决你的问题,请参考以下文章
HDU 2139 Calculate the formula
NLP Calculate the similarity of any two articles resume version