24.05.2014 Views

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

explain how the changes have been implemented and show sample results by<br />

comparing the new scheduler with the previous version.<br />

2.13.1 Thread Priority Calculation Changes<br />

All threads on the system have a priority value between 0 and 127, with 60 being<br />

the default initial value. As a thread runs and consumes CPU time, the priority<br />

value changes numerically as a function of CPU time recently used. A<br />

numerically higher number represents a less favored priority. A thread that<br />

started with the default priority of 60 may have an instantaneous priority in the<br />

range 60 to 126. The value of 127 is reserved for the wait process. The scheduler<br />

runs all threads at priority N that are marked as runable before it runs any threads<br />

at priority N+1, thus favoring threads using less CPU time.<br />

The nice and renice commands, and the setpriority system call, can be used to<br />

change the initial priority of a thread by a given delta. The delta can be in the<br />

range -20 to 19. Thus a thread can have an initial absolute priority in the range 40<br />

to 79. The absolute initial priority, or nice value, is included in the calculation of a<br />

threads priority. This introduces the idea of relative priority between threads.<br />

In addition to the nice value, the schedtune command can be used to fine tune the<br />

method used to calculate the new priority. The calculation also has parameters<br />

that scale the relative importance of recent CPU utilization (the -r option to<br />

schedtune, shown as sched_R) and historical CPU utilization (the -d option to<br />

schedtune, shown as sched_D). Both the sched_R and sched_D parameters<br />

have a default value of 16.<br />

On versions of <strong>AIX</strong> prior to <strong>4.3</strong>.2, thread priority is calculated using the following<br />

algorithm:<br />

• Once per clock tick: cpu = cpu + 1 for the currently running thread, limited to a<br />

maximum of 120<br />

• Priority calculation: (cpu * sched_R) / (2 * 16) + nice, limited to a maximum of<br />

126<br />

• Once per second ageing of all threads: cpu = cpu * sched_D / 32<br />

With the default values in place, this equates to:<br />

• Priority calculation: cpu / 2 + 60<br />

• Once per second ageing of all threads: cpu = cpu / 2<br />

The scheduler on <strong>AIX</strong> <strong>4.3</strong>.2 now uses the following algorithm to calculate thread<br />

priorities.<br />

• Once per clock tick: cpu = cpu + 1 for the currently running thread, limited to a<br />

maximum of 120<br />

• Priority calculation part 1:<br />

xnice = (nice > DEFAULT_NICE) ? (2*nice) - 60 : nice<br />

• Priority calculation part 2 (limited to a maximum of 126):<br />

p = (cpu * sched_R * (xnice + 4))/(32*(DEFAULT_NICE + 4)) + xnice<br />

• Once per second ageing of all threads: cpu = cpu * sched_D / 32<br />

<strong>AIX</strong> Kernel Enhancements 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!