java - Specifying an applications number of work threads -
i'm working on application heavy number crunching. intended run on single computer. recently, we've started looking @ multithreading speed calculations. of algorithms can made run parallel without effort, , use fixed thread pool run each of sub tasks.
what wondering is: how number of threads (the size of pool), typically specified these kinds of algorithms? suspect typically done using either configuration file, or commandline parameter, haven't seen examples that, wondering if there better ways.
related this: relevant specify number of threads? thinking setting pool size number of assignable cores run fastest, thread-contention processing power in case of on assignment relevant performance? eg: setting 20 max threads on 4 core machine worse setting 4 max threads?
edit: application intended sale, have no idea computers run on. i'm looking general guidelines, , best practices.
a rule of thumb use number_of_cores + 1
threads (certain parallel build systems use this) - 1 "spare" thread work during thread's io. find number of cores, refer this question.
Comments
Post a Comment