comparison src/os/windows/vm/os_windows.cpp @ 4854:de268c8a8075

7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11 Summary: Add CriticalPriority == MaxPriority+1 and enable scheduling class as well as thread priority to change on Solaris. Reviewed-by: dholmes, dcubed
author phh
date Thu, 26 Jan 2012 20:06:06 -0500
parents d7e3846464d0
children 379b22e03c32
comparison
equal deleted inserted replaced
4853:6db63e782d3d 4854:de268c8a8075
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
3294 3294
3295 // Win32 only gives you access to seven real priorities at a time, 3295 // Win32 only gives you access to seven real priorities at a time,
3296 // so we compress Java's ten down to seven. It would be better 3296 // so we compress Java's ten down to seven. It would be better
3297 // if we dynamically adjusted relative priorities. 3297 // if we dynamically adjusted relative priorities.
3298 3298
3299 int os::java_to_os_priority[MaxPriority + 1] = { 3299 int os::java_to_os_priority[CriticalPriority + 1] = {
3300 THREAD_PRIORITY_IDLE, // 0 Entry should never be used 3300 THREAD_PRIORITY_IDLE, // 0 Entry should never be used
3301 THREAD_PRIORITY_LOWEST, // 1 MinPriority 3301 THREAD_PRIORITY_LOWEST, // 1 MinPriority
3302 THREAD_PRIORITY_LOWEST, // 2 3302 THREAD_PRIORITY_LOWEST, // 2
3303 THREAD_PRIORITY_BELOW_NORMAL, // 3 3303 THREAD_PRIORITY_BELOW_NORMAL, // 3
3304 THREAD_PRIORITY_BELOW_NORMAL, // 4 3304 THREAD_PRIORITY_BELOW_NORMAL, // 4
3305 THREAD_PRIORITY_NORMAL, // 5 NormPriority 3305 THREAD_PRIORITY_NORMAL, // 5 NormPriority
3306 THREAD_PRIORITY_NORMAL, // 6 3306 THREAD_PRIORITY_NORMAL, // 6
3307 THREAD_PRIORITY_ABOVE_NORMAL, // 7 3307 THREAD_PRIORITY_ABOVE_NORMAL, // 7
3308 THREAD_PRIORITY_ABOVE_NORMAL, // 8 3308 THREAD_PRIORITY_ABOVE_NORMAL, // 8
3309 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority 3309 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority
3310 THREAD_PRIORITY_HIGHEST // 10 MaxPriority 3310 THREAD_PRIORITY_HIGHEST, // 10 MaxPriority
3311 THREAD_PRIORITY_HIGHEST // 11 CriticalPriority
3311 }; 3312 };
3312 3313
3313 int prio_policy1[MaxPriority + 1] = { 3314 int prio_policy1[CriticalPriority + 1] = {
3314 THREAD_PRIORITY_IDLE, // 0 Entry should never be used 3315 THREAD_PRIORITY_IDLE, // 0 Entry should never be used
3315 THREAD_PRIORITY_LOWEST, // 1 MinPriority 3316 THREAD_PRIORITY_LOWEST, // 1 MinPriority
3316 THREAD_PRIORITY_LOWEST, // 2 3317 THREAD_PRIORITY_LOWEST, // 2
3317 THREAD_PRIORITY_BELOW_NORMAL, // 3 3318 THREAD_PRIORITY_BELOW_NORMAL, // 3
3318 THREAD_PRIORITY_BELOW_NORMAL, // 4 3319 THREAD_PRIORITY_BELOW_NORMAL, // 4
3319 THREAD_PRIORITY_NORMAL, // 5 NormPriority 3320 THREAD_PRIORITY_NORMAL, // 5 NormPriority
3320 THREAD_PRIORITY_ABOVE_NORMAL, // 6 3321 THREAD_PRIORITY_ABOVE_NORMAL, // 6
3321 THREAD_PRIORITY_ABOVE_NORMAL, // 7 3322 THREAD_PRIORITY_ABOVE_NORMAL, // 7
3322 THREAD_PRIORITY_HIGHEST, // 8 3323 THREAD_PRIORITY_HIGHEST, // 8
3323 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority 3324 THREAD_PRIORITY_HIGHEST, // 9 NearMaxPriority
3324 THREAD_PRIORITY_TIME_CRITICAL // 10 MaxPriority 3325 THREAD_PRIORITY_TIME_CRITICAL, // 10 MaxPriority
3326 THREAD_PRIORITY_TIME_CRITICAL // 11 CriticalPriority
3325 }; 3327 };
3326 3328
3327 static int prio_init() { 3329 static int prio_init() {
3328 // If ThreadPriorityPolicy is 1, switch tables 3330 // If ThreadPriorityPolicy is 1, switch tables
3329 if (ThreadPriorityPolicy == 1) { 3331 if (ThreadPriorityPolicy == 1) {
3330 int i; 3332 int i;
3331 for (i = 0; i < MaxPriority + 1; i++) { 3333 for (i = 0; i < CriticalPriority + 1; i++) {
3332 os::java_to_os_priority[i] = prio_policy1[i]; 3334 os::java_to_os_priority[i] = prio_policy1[i];
3333 } 3335 }
3336 }
3337 if (UseCriticalJavaThreadPriority) {
3338 os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority] ;
3334 } 3339 }
3335 return 0; 3340 return 0;
3336 } 3341 }
3337 3342
3338 OSReturn os::set_native_priority(Thread* thread, int priority) { 3343 OSReturn os::set_native_priority(Thread* thread, int priority) {