in reply to Efficiency of threads::shared versus Thread::Pool
Agreed. Just do it like they do it in any restaurant. Work-to-do goes into a (thread safe) queue, and whoever happens to be free grabs another unit of work off the queue and starts to prepare it. Any thread that does not have anything to do goes to sleep, waiting for something to eventually show up in the queue.
Allocate a “reasonable, and configurable,” number of threads or processes, consistent with your knowledge of the number of cores and of the system’s pragmatic I/O capacity. It now becomes the operating system’s familiar task to keep the various cores and disk-drives busy. Thanks to the “throttles” and the “governors” that you have designed into your software contraption, the OS is presented with a requirement that can actually be achieved and sustained.