• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

priority

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://stackoverflow.com/questions/297804/thread-api-priority-translation-to-os-thread-priority

Solaris

* 1 ⇒ 0
* 2 ⇒ 32
* 3 ⇒ 64
* 4 ⇒ 96
* 5 – 10 ⇒ 127

Of note is that on Solaris, you can't raise the thread priority above normal, only lower it: the priority value for 5 is the same as any of the higher values.
Linux

* 1 – 10 ⇒ 4 – -5 (nice values)

Of note is that on Linux, different thread priorities in Java do map to distinct priority values at native level.
Windows

* 1 – 2 ⇒ THREAD_PRIORITY_LOWEST
* 3 – 4 ⇒ THREAD_PRIORITY_BELOW_NORMAL
* 5 – 6 ⇒ THREAD_PRIORITY_NORMAL
* 7 – 8 ⇒ THREAD_PRIORITY_ABOVE_NORMAL
* 9 – 10 ⇒ THREAD_PRIORITY_HIGHEST


In linux , Is it overhead windows? I mean 10 is the highest priority in windows , But in linux , is it the lowest priority?



Another question:

http://www.javamex.com/tutorials/threads/priority_what.shtml

In this site there is a table that shows priorities in windows

Is this table is similar for all windows versions?

Dose anyone knows priority for different version of windows?(VISTA .7. XP and..)


 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java thread priority is an abstraction of the OS thread priority. So if you set the java thread priority to the max it will (probably) create a thread with a high OS thread priority.
But the JVM doesn't guaranty that a thread with a high priority will get more cpu time then a thread with a low priority. It depends on the implementation.
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread.setPriority(Thread.MAX_PRIORITY); is equal to thread.setPriority(10); on Windows platform, but what on some other platform? Is that equal for each OS or 10 could be different value on Unix, MacOS or whichever? How does Java map priorities?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I pointed about in my previous, apparently unclear, response. The java threading priority is an abstract of the os thread priority. So if you set thread.setPriority(10) then it will get a high priority on windows, linux, mac etc.
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not all JVMs have the same number of priority levels


Is that correct?Do you know any Doc that justify this?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look it up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic