Wednesday, August 25, 2010

controlling cpu usage part 3: Manipulating the dispatch parameter tables

Each scheduling class maintains a set of tables in the kernel. These are used to control aspects of the scheduling class. These tables may be manipulated by the dispadmin command:


 # dispadmin -l
 CONFIGURED CLASSES
 ==================

 SYS     (System Class)
 TS      (Time Sharing)
 FX      (Fixed Priority)
 RT      (Real Time)
 IA      (Interactive)

Changing the Scheduler
Solaris comes with six defined scheduling classes. Of these classes four are provided for use by user threads time sharing (TS), interactive (IA), fixed priority (FX) & fair share scheduling (FSS) . the other two are system, for kernel threads, and real-time.
If there are multiple processor sets in use then each processor set can theoretically use a different scheduling class. This is only practical when using the pool subsystem, which allows scheduling class to be specified per pool.
Time Sharing/Interactive Scheduling Classes
Time sharing and interactive classes use the same algorithm, the difference between them is that interactive scheduling class attempts to provide a slight boost to the foreground process
The two classes provide a table which has entries for:
  • quantum - number of time periods allowed
  • tqexp - priority to change thread to when quantum expired
  • slpret - priority to change thread to when returning from a sleep
  • maxwait - maximum number of seconds to wait for CPU before changing priority
  • lwait - priority to change thread to when maxwait expired


 # dispadmin -g -c TS
 # Time Sharing Dispatcher Configuration
 RES=1000

 # ts_quantum  ts_tqexp  ts_slpret  ts_maxwait ts_lwait  PRIORITY LEVEL
       200         0        50           0        50        #     0
       200         0        50           0        50        #     1
       200         0        50           0        50        #     2
       200         0        50           0        50        #     3
       200         0        50           0        50        #     4
       200         0        50           0        50        #     5
       200         0        50           0        50        #     6
       200         0        50           0        50        #     7
       200         0        50           0        50        #     8
       200         0        50           0        50        #     9
 ...
       160         0        51           0        51        #    10
       160         1        51           0        51        #    11
       160         2        51           0        51        #    12
       160         3        51           0        51        #    13
       160         4        51           0        51        #    14
 ...
        40        40        58           0        59        #    50
        40        41        58           0        59        #    51
        40        46        58           0        59        #    56
        40        47        58           0        59        #    57
        40        48        58           0        59        #    58
        20        49        59       32000        59        #    59

To change the dispatch parameter table for the TS and IA classes create a new table in a file and insert this file into the running kernel:


 # dispadmin -c TS -g > new_table
 # ( edit new_table )
 # dispadmin -c TS -s new_table

The new table will come effect immediately no reboot is required here. But the change will only have effect during the current life-time of the current boot time. To make the change effective on subsequent boots the dispadmin -c TS -s new_table has to be run as an initialization script on each boot. It is recommended the this is placed after the single-user milestone is reached to enable the system to be booted to single user mode in the case the table turns out to be incorrect.


No comments:

Post a Comment