What about using GNU Parallel ?
"If you know all commands that you want to execute up-front, then the solution gets far simpler":
https://emmer.dev/blog/concurrent-shell-command-queues/#why-...
Or plain xargs...
"If you know all commands that you want to execute up-front, then the solution gets far simpler":
https://emmer.dev/blog/concurrent-shell-command-queues/#why-...