I have to run hundreds of java processes in Linux for my project. But running so many processes simultaneously is impossible due to scarcity of system resources. That being said, I have to partition all the processes into continuous blocks, each block running 6 processes. But it not ideal because the consecutive block can't start running until all the 6 processes of previous block are completed. What I want is to bypass the block method, only set the threshold of 6. When one process is completed, the mechanism will automatically start a new process, similar to Java's blockingqueue. Is it possible to do it in bash shell script? Thanks for in advance.