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.
Asked
Active
Viewed 65 times
3
-
1Could you please share the code you already have? – Marcono1234 Sep 05 '20 at 15:17
-
Why do you need so many java processes? Would it be possible to do everything in one java prodess using multithreading in java? This would not need so much resources because there is only one JVM running. – Donat Sep 06 '20 at 11:10