| Author |
Threads
|
Ritu Kapoor
Ranch Hand
Joined: Oct 03, 2004
Posts: 101
|
|
Code: ---------------------------------------------------------- What is the default priority of a thread?Select one correct answer. Depends upon Operating System. The default priority is 1. The default priority is 5. The default priority is 10. ------------------------------------------------------------ Can anybody answer it?
|
 |
agrah upadhyay
Ranch Hand
Joined: Sep 01, 2005
Posts: 579
|
|
|
I Think Default priority is inherited from parent thread
|
<i>--Agrah Upadhyay--</i><br />Final Year B.Tech SCJP,SCWCD,SCBCD <br /> <br /><b>Now since the real test for any choice is having to make the same choice again,knowing full well what it might cost.</b>-Oracle
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
---------------------------------------------------------- What is the default priority of a thread?Select one correct answer. Depends upon Operating System. The default priority is 1. The default priority is 5. The default priority is 10. ------------------------------------------------------------ Can anybody answer it?
Yes. And you can too, with a minimal amount of searching. Hint: Look for the constant field value of Thread.NORM_PRIORITY in the API.
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
I Think Default priority is inherited from parent thread
That is correct; however, one might feasibly ask for the default priority of the parent, and so on... If you don't specifically set a priority, there *is* a default priority. http://www.google.com/search?q=java+thread+default+priority
|
 |
harish shankarnarayan
Ranch Hand
Joined: Sep 12, 2005
Posts: 158
|
|
hi i have read that the default priority of the thread is 5. wats the correct ans if its wrong how to determine it. can anyone throw some light on priorities of thread.
|
Harish<br />SCJP 1.4 (85%)
|
 |
agrah upadhyay
Ranch Hand
Joined: Sep 01, 2005
Posts: 579
|
|
For every thread it is not 5.for garabage collector thread it can be lessthan 5.......and so on.But you can explicitly set it final void setPriority(int)
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
i have read that the default priority of the thread is 5. wats the correct ans if its wrong how to determine it. can anyone throw some light on priorities of thread.
That is correct, per the Thread API.
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
The Java� Programming Language (3rd Ed.) has this to say: A thread's priority is initially the same as the priority of the thread that created it. The priority can be changed using setPriority with a value between Thread's constants MIN_PRIORITY and MAX_PRIORITY. The standard priority for the default thread is NORM_PRIORITY. The priority of a running thread can be changed at any time. If you assign a thread a priority lower than its current one, the system may let another thread run, because the original thread may no longer be among those with the highest priority. The getPriority method returns the priority of a thread. Note: Do *not* - I repeat do *not* - rely on the behavior of the thread scheduler. Hope this helps...
|
 |
 |
|
|
subject: Threads
|
|
|