java - Is there any maximum limit to number of running threads in Linux? -
this question has answer here:
is there maximum limit number of running threads in linux? possible count total number of threads classes in java?
technically should use 2 x numberofphysicalcores threads optimal performance. this post describes maximum number of threads (thanks @gavriel finding :p)
next, number of running threads in current jvm:
public static void main(string[] args) throws ioexception, interruptedexception { executorservice service = executors.newfixedthreadpool(4); service.execute(new runnable() { public void run() { try { thread.sleep(1000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } }); system.out.println(thread.getallstacktraces().size()); } o/p : 5
Comments
Post a Comment