| Author |
Thread Priority not working properly
|
Kashinath Roy
Greenhorn
Joined: Apr 21, 2009
Posts: 9
|
|
But Why low is executing count more then High thread despite low priroty is low
Code:
Eclipsc IDE OUTPUT
Low-priority thread: 382730681
High-priori thread: 22847397
|
 |
Harsha Smith
Ranch Hand
Joined: Jul 18, 2011
Posts: 287
|
|
|
Thread priorities don't often produce desired results. Although you can assign higher priority to the tasks you want to run before others, this may not work as you expect and also I think it depends on the OS
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 14608
|
|
Computers can do a lot in 10 seconds. Are you sure that the integers are not overflowing?
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Nomaan Butt
Ranch Hand
Joined: Oct 19, 2011
Posts: 54
|
|
one can't be sure of the outcome when using threads, a lot depends on the OS and JVM. By the way in my system your program is giving expected results see below,
Low-priority thread: 1580488402
High-priori thread: 1658625472
try changing the priority values, which jvm you are using?
|
 |
 |
|
|
subject: Thread Priority not working properly
|
|
|