thread priority mapping to jstack prio

218 views
Skip to first unread message

Kevin Burton

unread,
Jun 8, 2015, 12:50:39 AM6/8/15
to mechanica...@googlegroups.com
Can't find any documentation on this so I figured I'd post here.

I have a thread which should be in MIN_PRIORITY (1) .. and if I execute it, and read back the priority, it's correct.

However, when I run 'jstack' on the JVM I get back prio=5 which is NORM_PRIORITY...

In production, they're all being set to prio=10.. which is even weirder.  

I haven't had a problem with this before so I'm really confused as to what's happening.


Kevin Burton

unread,
Jun 8, 2015, 1:02:43 AM6/8/15
to mechanica...@googlegroups.com

Peter Booth

unread,
Jul 8, 2015, 1:31:34 AM7/8/15
to mechanica...@googlegroups.com
Remember there's another factor to consider here: Thread.setPriority() doesn't do anything in Linux for the common case.

It only has an effect if you use the switch
-XX:ThreadPriorityPolicy and run as root. It's funny how much Java code I see that valiantly attempts to define thread priorities without using these.

Peter

Jan Kotek

unread,
Jul 8, 2015, 11:07:28 AM7/8/15
to mechanica...@googlegroups.com
Perhaps there is workaround to change priority of single thread (not entire JVM) from command-line.

Jan
Reply all
Reply to author
Forward
0 new messages