Using Solaris RT scheduler class to get things done on an overloaded machine

Sometimes when you login to a Solaris NFS server, there is so much going on that you can hardly get anything done. Guds takes forever, ps takes 30 seconds, and you make little progress. Fortuitously, it’s very easy to adjust your scheduling priority on the CPU so that you can get things done. Once you give yourself a guarantee portion of the scheduler table, response for that process returns mostly to normal.

[[root@x4240-3-2-5 15:24:05 nfslog 46]]$ echo $$
12998
[[root@x4240-3-2-5 15:24:11 nfslog 48]]$ priocntl -s -c RT -t 2 -r 100 12998
[[root@x4240-3-2-5 15:24:40 nfslog 49]]$ priocntl -d 12998
REAL TIME PROCESSES:
PID[/LWP] RTPRI TQNTM TQSIG
12998 0 20 0
[[root@x4240-3-2-5 15:24:41 nfslog 50]]$

What did I do? I found out my current pid (bas shell). By default all proceses are part of the ‘time sharing’ scheduler class, which is a good general-purpose class that weights interactive processes to run with smaller time quanta more frequently and long running processes automatically gets larger quanta chunks that are run less frequently.

I’ve selected that my process will be scheduled in the RT (Real Time) scheduling class, which has priority over all other scheduling classes in the scheduler. Further, I’ve guaranteed that my process will get 2 quanta out of every 100 for the scheduler, when it asks. That is ample for collecting performance statistics and almost any interactive task.

Priocntl can also be used to execute a command with a higher scheduler likelihood. For instance, if I wanted to keep my shell responsive but also execute a guds with a slightly higher scheduling priority, I could use the –e flag to do it like this:

# priocntl –e –c RT –t 5 –r 100 /usr/local/bin/guds_2.9.1a

There are a lot more options than this for setting relative priority, tweaking resolutions, adjusting priority limits. The fact that priocntl –d 12998 shows 20 is because it’s displaying in terms of parts per 1000.