| Author |
why thread priority is not working here
|
saikrishna cinux
Ranch Hand
Joined: Apr 16, 2005
Posts: 689
|
|
i ran tis program for many times but it is not displaying according to threads priority? why?
|
A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
|
 |
Ankur Sharma
Ranch Hand
Joined: Dec 27, 2005
Posts: 1234
|
|
Originally posted by saikrishna cinux: i ran tis program for many times but it is not displaying according to threads priority? why?
Well I run this program on my m/c I got output according to the expectaions. I am giving here output on my m/c
Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main] Thread[thread two,10,main] Thread[thread three,5,main] Thread[thread one,1,main]
Well I think it's according to your expectations, what you was expecting could you let me know..... according to your code.. th2 is with MAX_PRIORITY th3 is then and at last is th1 [ September 26, 2006: Message edited by: Ankur Sharma ]
|
The Best way to predict your future is to create it
Ankur Sharma
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
While a thread sleeps, other threads are allowed to execute. Priority only comes into play when two threads try to do something at the same time, which is not guaranteed to happen at all for our example. Moving to our threads forum...
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
 |
|
|
subject: why thread priority is not working here
|
|
|