I am running a genome assembly program *Trinity, http://trinityrnaseq.sourceforge.net/, if interested) on one of the XSEDE resources. The hardware limits the number of threads to 2500, which the program always wants to exceed... It there an easy way to limit the number of threads executed? I have tried -XX:ParallelGCThreads=16
, but this seems to introduce new errors.
So, is there a runtime command to limit the total number of threads??
Each JVM server can have a maximum of 256 threads to run Java applications. In a CICS region you can have a maximum of 2000 threads. If you have many JVM servers running in the CICS region (for example, more than seven), you cannot set the maximum value for every JVM server.
You cannot. There is no way to stop a Thread unless it co-operates.
Whenever we want to stop a thread from running state by calling stop() method of Thread class in Java. This method stops the execution of a running thread and removes it from the waiting threads pool and garbage collected. A thread will also move to the dead state automatically when it reaches the end of its method.
Every Java program contains at least one thread: the main thread. Additional threads are created through the Thread constructor or by instantiating classes that extend the Thread class. Java threads can create other threads by instantiating a Thread object directly or an object that extends Thread .
Use an Executor or ExecutorService. Does what bragboy suggests but it's built in to Java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With