[threadpool] Add heuristic to approach the optimal number of threads
[threadpool] Remove process_idle_times so monitor_thread is the only function to change the number of threads