JDK-7132966 : Allow mapping of Java thread priorities to OS scheduling classes as well as priorities
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs23
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2012-01-24
  • Updated: 2014-03-05
  • Resolved: 2014-03-05
Related Reports
Relates :  
Description
Hotspot current allows a user to map Java thread priorities (1-10) to OS native
priorities via the 10 JavaPriority<n>_To_OSPriority switches.  We could add
another set of 10 switches, call them JavaPriority<n>_To_OSSchedulingClass,
to specify the scheduling class as well.

This CR

7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on
         Solaris 10 and 11

went a little way down the path of being able to specify an alternative
scheduling class.  In that CR, critical thread priority maps to the FX60
scheduling class/priority on Solaris.  On other platforms, critical
priority maps to the same OS scheduling class and priority as MAX_PRIORITY.
This CR requests generalization of 7082553 to arbitrary scheduling classes
and non-solaris platforms.

Comments
RT Triage Team: We have no plans to change this behavior. Any improvement to this area should be addressed through a JEP and we'd be happy to address through additional requirements.
05-03-2014

The intent here was to allow experimentation with using different scheduling classes and in the process discover whether/where there are problems in the VM in doing so. The main targets were the IA and FX scheduling classes on solaris.
03-03-2014

I thought this is not a good thing to do because there isn't a direct mapping and having a mapping may interfere with JVM threads? Do we really want to do this?
28-02-2014

PUBLIC COMMENTS I would suggest changing the existing JavaPriority<n>_To_OSPriority so that they take a string of the form <scheduler>:<priority>. The scheduler is platform specific. On Solaris it would be the scheduling class: TS, IA, FX, FS, RT, with a numeric priority to suit. On a POSIX system it could be SCHED_OTHER, SCHED_FIFO, SCHED_RR. If the value is just a number it is a priority associated with the "default scheduler" (TS on Solaris, SCHED_OTHER on POSIX. You could even add options to set the default scheduler, and then add an option to take the complete priority mapping at once eg: -XX:DefaultScheduler=FX -XX:JavaPriorityMappings="1, 2, 4, 8, 16, 32, 35, 40, 45, 50" If a real-time scheduler is selected the VM should print copious dire warnings and disclaimers. ;-)
25-01-2012