4.4. Tuning Tasks with Tuna
To change policy and priority information on threads, use the
--priority
parameter:
#
tuna --threads=pid_or_cmd_list --priority=[policy:]rt_priority
- The pid_or_cmd_list argument is a list of comma-separated PIDs or command-name patterns.
- Set the policy to
RR
for round-robin,FIFO
for first in, first out, orOTHER
for the default policy.For an overview of the scheduling policies, see Section 6.3.6, “Tuning Scheduling Policy”. - Set the rt_priority in the range 1–99. 1 is the lowest priority, and 99 is the highest priority.
For example:
#
tuna --threads=7861 --priority=RR:40
To verify the changes you set, use the
--show_threads
parameter both before and after the modifying --priority
parameter:
#
tuna --threads=sshd --show_threads --priority=RR:40 --show_threads
thread ctxt_switches pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 1034 OTHER 0 0,1,2,3 12 17 sshd thread ctxt_switches pid SCHED_ rtpri affinity voluntary nonvoluntary cmd 1034 RR 40 0,1,2,3 12 17 sshd
This allows you to compare the state of the selected threads before and after your changes.