Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Threading in multiple CPUs  RSS feed

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In multi CPU environment how does threading work, and how does the allocation of threads/process take place across different CPUs
 
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how does threading work



I don't get your question. What do you mean by threading? Could you provide some more details?

how does the allocation of threads/process take place across different CPUs


It's an implementation detail of the OS and the scheduler in question. Why do you need to know this? Also if at all you need to know this, you can do a complex testing on the system in question and after many days ( if not months ) of testing, you might get an idea. And then it may change as well. I hope you know that a process and a thread are two different things?


Chan.
 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chan thanks for quick and blunt answer. I should have put some more details in question, which i initially though would be obvious.

Let us say we have process p1 and p2. Each process can spawn threads t1....tn. Let us also assume i am working 2 processor environment with all other conditions(single & double processor) being same.

Let us say p1 is running on processor1 and p2 is running on processor2. p1 spawns threads t1,t2 and p2 spawn threads p3,p4.

question: When p1 spawns threads the does it run on a specific processor or can it switch the processors. I understand that it will depend on the environment(OS), but theoretically how does it work.

If i have to use concepts like synchronization, wait , sleep, join, notify etc. do i need to worry about the numbers of processors, or all the details are abstracted from user, and OS takes care of the stuff.
 
Sheriff
Posts: 23640
48
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Naresh Chaurasia wrote:If i have to use concepts like synchronization, wait , sleep, join, notify etc. do i need to worry about the numbers of processors, or all the details are abstracted from user, and OS takes care of the stuff.



You'll notice that the Thread class in Java doesn't have any methods which refer to processors, multiple or otherwise, in any way. Which means that how the JVM and the Thread class and the operating system will deal with allocating threads to processors is completely hidden from you.

And if you look farther I expect you'll see that the tutorials about Thread don't mention anything about that issue either. Another hint that it's none of your business.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!