Jvm utilizes multicore
I am new to this forum and i need your help.
Question: I want my jvm to utilize all my cores as i have a quad core system.
I came across that jvm runs on single kernal thread thus other threads remains un utilized and
I also come across that if we fully utilize jvm efficiently then there is 1 to 1 mapping between jvm
threads and system threads but these both statements can not be true simultaneously so please help me.
So, please help me so that i can get out of this confusion and can run my application.
The main thing you need to do to really "utilise" the multiple cores is write your application to use multiple threads where those threads can (a) run simultaneously and (b) use CPU. The JVM generally can't magically do this for you-- YOU need to architecture your application to use threads appropriately.
The JVM *can* to a very limited extend use multiple CPUs automataically for garbage collection, but this is really minimal-- if your app spends 5% of its CPU time on garbage collection, then with a million squillion cores, the best speedup you'll get is 5%...
I have another question that jvm utilizes 1 kernal thread for execution
I want that jvm uses 3 or 4 kernal threads for its execution.
Is it possible for me to do it.
Why? The JVM runs as it has been coded. If you want to utilize the other cores of your processor for your programs, then you need to do that yourself.
Originally Posted by neeti
I would verify your statement about "JVM utilizes 1 kernel thread for execution". I'm fairly sure that in recent versions of Hotspot, the JVM uses multithreaded garbage collection by default. But how beneficial this really is depends on what proportion of time is spent on garbage collection. As I say, the main thing you need to do is architecture *your* code to multithread.