File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Threading  Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Threading  Question" Watch "Threading  Question" New topic

Threading Question

Sean Walker
Ranch Hand

Joined: Feb 04, 2004
Posts: 64
In the book 'Sun Certified Programmer & Developer for Java2' the following point is a point made:
Only one thread can be running at a time, although many threads may be in the runnable state.

But this isn't necessarily true is it? If the JVM is running on a multiprocessor box surely more than one thread can be in the running state - no?

Sean Walker<br />PMP, SCEA, SCWCD, SCJP
Loveen Jain
Ranch Hand

Joined: Jan 24, 2004
Posts: 35
Well, thats really a question that one needs to think about.
Although i havent done Parallel and Distributed Computing in much detail, but still as far as i know and can make out of ur question is that, when u are implementing a parellel algorithm then ofcourse more than one threads will be running at the same time(in case of parallel microprocessor architecture), but if its not the case than u must know that even if the underlying architecture is multiprocessor, only one processor will be handling the main control of the program and the rest will be working either as the coprocessors or might be doing some other jobs, so in this case JVM will be having only one thread in the running state.

Sean Walker
Ranch Hand

Joined: Feb 04, 2004
Posts: 64
You lost me.
What is a 'parallel algorithm' if not any program in which more than one thread is executing. Of course I am aware that some algorithms have parallel and serial counterparts, but that's beside the point isn't it?
Okay, I went googleing and found a link that I think pretty clearly describes how JVM's map to an underlying architecture's threading model.
web page
So in a one-to-one or many-to-many JVM model, you can have different threads running actually concurrently on separate processors.
I agree. Here's the link:
subject: Threading Question
It's not a secret anymore!