Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Threads in a single processor

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You have to be odd to be #1 - Seuss. An odd little ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic