This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

newly created thread state?

 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
source : http://www.santis.ch/training/java/jcp/selftester

exact question is this :
what is the initial state of a new created and started thread?

and options are :
1. New
2. Not Runnable
3. Ready
4. Running
5. Dead

I selected Running because I saw the word "started" in the question.. that means start() was called.. did I interpret it wrong? Anyone else feels question is not so clear ?
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are we supposed to do? What do you expect from us, the ranchers?
Please be kind enough to post the code!
 
Bob Wheeler
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a thread was started (by invoking start()) its state is "Runnable". Other states are "New", "Running", "Waiting/Blocking" and "Dead"; all based on K&B.

cheers
Bob
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sudipto shekhar wrote:What are we supposed to do? What do you expect from us, the ranchers?


1. I asked the ranchers, did I interpret the question wrong ?

sudipto shekhar wrote: Please be kind enough to post the code!


2. I asked you the exact question and I have given the link to the source.. there is no code for it... it is a "question" if you didn't notice.. and there are 5 choices, I selected one of them and the mock test told me I was wrong.. So I asked, " Did I interpret it wrong ? "

Sorry, I dont understand why you were mad at me..
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob Wheeler wrote:If a thread was started (by invoking start()) its state is "Runnable". Other states are "New", "Running", "Waiting/Blocking" and "Dead"; all based on K&B.



Runnable means "Ready" here ? So it is not yet running?
 
Bob Wheeler
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shrinath M Aithal wrote:
Bob Wheeler wrote:If a thread was started (by invoking start()) its state is "Runnable". Other states are "New", "Running", "Waiting/Blocking" and "Dead"; all based on K&B.



Runnable means "Ready" here ? So it is not yet running?

I guess so. But I have never heard of this status. I don't know on what basis this test is done.
Runnable means, the thread is "ready" to start. The thread can come back to this status after waiting/blocking. I just don't like to give this status a different name.
If you get a question like this in the exam, they'll use the term "Runnable".
To answer your question: yes.

cheers
Bob
 
Shrinath M Aithal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok Bob.. thank you seems like a lot of things are wrong with this test.. if you open the scjp mock tests page in ranch, it is the third one, which opens up a german site..

there are misleading answers too.. like the test says + is not overloaded in wrapper classes..
So no worries..
thank you
 
Bob Wheeler
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shrinath M Aithal wrote:ok Bob.. thank you seems like a lot of things are wrong with this test.. if you open the scjp mock tests page in ranch, it is the third one, which opens up a german site..

there are misleading answers too.. like the test says + is not overloaded in wrapper classes..
So no worries..
thank you

No prob.
I didn't use them. I used examLab (5 exams altogether) and the K&B stuff (2 exams+1). First of all I would use them. I really liked them
The examLab was really tough, but afterwards you know where you have to invest some time.

Have Fun and cheers
Bob
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shrinath M Aithal wrote:
Bob Wheeler wrote:If a thread was started (by invoking start()) its state is "Runnable". Other states are "New", "Running", "Waiting/Blocking" and "Dead"; all based on K&B.



Runnable means "Ready" here ? So it is not yet running?



Runnable means it is ready to run. to be more precise, it means that the process is ready to execute but is not yet scheduled by the processor to run. Running means that the process is currently being executed..
When the thread is popped back to runnable that means again the thread is ready to run but is not running. yes when the start() is invoked that means the thread is ready to run but is not scheduled by the scheduler to run...Which thread is scheduled at what time completely depends on the scheduler and the scheduling algorithm that is being used by the system....

Hope this helps....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic