aspose file tools
The moose likes Threads and Synchronization and the fly likes Threads in a single processor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Threads in a single processor" Watch "Threads in a single processor" New topic
Author

Threads in a single processor

Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67
Dear Sir

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
with regards,
Komal
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35240
    
    7
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.


Android appsImageJ pluginsJava web charts
Gerbrand van Dieijen
Ranch Hand

Joined: Nov 28, 2008
Posts: 30
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Threads in a single processor
 
Similar Threads
Will thread priorities within JVM affect JVM process priorities?
JVM and Classloader
MultiThreading in java working in MultiProcessor
To scott and Henry
Threads running on single-core or multi-core?