5
I’m analyzing how to rewrite the architecture of a Java program I’d like to know how many threads the scheduler (Scheduler) supports? or how can I infer this amount based on the processing power of my PC/Server/Cluster?
5
I’m analyzing how to rewrite the architecture of a Java program I’d like to know how many threads the scheduler (Scheduler) supports? or how can I infer this amount based on the processing power of my PC/Server/Cluster?
4
I don’t know a problem where a large number of threads can help. You may have thousands of threads on most modern computers and even tens of thousands on more powerful servers, but that won’t help at all depending on the problem you’re solving. Maniero has already talked a little about it.
Also, a limit still depends on the JVM you are using. In a controlled environment, you can measure and determine a theoretical limit, after all it can vary depending on the use the machine is having over time.
Create a program that does the following:
Let the program run for a while, play the values saved in a spreadsheet and you will have a relation of the number of threads with the memory used.
Note that none of this has to do with performance, as when there are many more threads than Cpus performance tends to drop due to scaling overhead.
In parallelism work I’ve done, I had to experiment with the problem with different number of threads to determine the optimal amount. But all of this still involves details of how threads communicate and consolidate the result at the end.
I suggest you formulate your problem completely in a new question and ask about your approach, whether it would be adequate, rather than asking about a technical detail that probably won’t be decisive in its implementation.
3
This information is not relevant. The processing architecture and the operating system will determine this. There may be a theoretical limit, but what will determine the limit is practicality.
It is only possible to know how many threads use testing. Even so it is not easy to find a balance in many situations. What can be good at one time may not be more at another.
Two threads can be a lot. Thousands can eventually be perfectly bearable.
In cases where the thread really is the solution it is common for the ideal number to be equal or close to the number of logical processors.
Producing parallel code correctly and efficiently is not something simple. It is very easy to make mistakes when you leave trivial cases. Make sure you have won and that the effort pays off. There are many cases that there was gain ending the use of thread. To help there are some libraries of higher level that facilitate a little the work taking care of part of the complexity.
You can better understand this question.
Browser other questions tagged java java-ee thread multithreading scheduler
You are not signed in. Login or sign up in order to post.