How does Java decide which core to assign a thread or a process? Is there any way to control that? to prevent two large threads from executing on the same core?
Basi
This really depends on the implementation on the JVM, but in general, Java implementations rely on the underlying OS's threading functionality. To the best of my knowledge there are no public and standard extensions to set an affinity. There may be experimental JVMs that offer hooks, however.
Furthermore, interfering with the JVM abstraction to mess directly with the underlying platform goes, to a degree (and IMHO), against the spirit of Java.