Thanks Phil. I take it it would be rather silly to call 20 Async’s on a 16 thread CPU? Not that I am going to or need to, but what would happen, it would queue 4 until a thread becomes available? But also dangerous because the call might affect the main GUI thread?
Number of threads depends on JAVA and the underlying OS not Jython and I think we need not be over concerned about it as developers as long as we are implementing some reasonable features with it! It also depends upon whether you are using it on client side or server side, lest you should block the server it self due to some bug it our code or implementing some compute intensive or blocking code ! Of course we should know the system limitations but they are practically unlimited for reasonable requirements.
If you’re interested in that topic, it’s called CPU scheduling. It’s effectively the responsibility of the OS, but applications can have an influence on it (especially to schedule internal threads like in the JVM).
Basically the OS will try to distribute the CPU time evenly over the different threads that need it, without waiting too long, and without causing too much context switches (context switches have even become more costly due to spectre, meltdown and similar CPU bugs). Those requirements are efectively contradictory: the longer you wait to switch, the less evenly you can distribute the time and the longer threads have to wait.
But default settings should be generic enough to have a good performance in most cases. You really need to study those options a lot and test them with trial-and-error to get a better performance from it.
In case this wasn’t clear, it’s actually a rabbit hole. It’s nice you can do those configurations. But unless it’s really needed (like for supercomputer applications where every added bit of performance has high value), you’ll likely to lose more time configuring it than you will ever gain from it.