I have read that creating multiple threads is like breaking a task into different pieces and running each piece on a seperate processor. On a single processor, Does it imply does it imply that we are creating a seperate JVM over the JVM for each thread as proceesing requires a processor.
Thanks in advance
Joined: Mar 22, 2005
No. All threads run in the same JVM. The JVM is capable of running multiple threads on the same processor; some JVMs can even utilize multiple processors by scheduling threads on different processors. But there's still only a single JVM instance.
The OS (like Windows or Unix) accomplish running multiple threads on a single CPU by means of context-switching. Each thread (and any other program running simultaneously) gets to do its think for a very short period of time, after which the OS does a context switch to give another thread a short period of time to do operations. See Context switch on Wikipedia. Only on a multi-core or multi-processor computer to threads can run truly simultaneously.