(TK-13) Dynamic default for max-threads set

On machines with a large number of cores, the default thread pool size
of 100 is too small. This commit will calculate the minimum number of
threads needed to run, and use that as the max-threads value if one
isn't already set in the configuration.
Hmm, this does make me wonder if this function could have a better name. I'll try and think something up.