next up previous
Next: Measurements and Results Up: Installation Instructions Previous: Patch the kernel

Manage the classes

The new kernel will add file named ``/proc/classes'' to the /proc filesystem. This is file is readable to all but only writable to the root user. Run ``cat /proc/classes'' you will see something like this:

#classinfo - version: 1.0
#output format: class_id class_name weight CVT nr_running
#input format:
# (add class): 1 classid weight name
# (set class): 2 classid pid 0

0 Default       100 105382799 1
1 best_effort   1 124734328 0
2 blonze        9 124465338 0
3 silver        30 124420096 0
4 gold  60 124432753 0

As the comment says, this file reports the current classes configuration. The meaning of class_id, name and weight is self-explanatory. CVT means the normalized value of the CPU time this class has received. nr_running means how many tasks are running in this class. The ``default'' class is created by the kernel. If you don't change class setting, all the tasks run under default class.

You can add a class to the system by writing to this file. For example, you can execute a command like ``echo 1 4 60 gold > /proc/classes'' to add a class named ``gold'' with class_id = 1 and weight = 60.

You can use the ``set class'' command to run a process under a different class. For example, executing the command ``echo 2 4 765 0 > /proc/classes'' will set the class_id of process with pid 765 to 4 (the gold class). When a new process forked, it will inherit its parents class_id.

I realized that we certainly also need commands to remove classes, change the class weight etc. These functionality will be added in the later releases. They are coming soon ... :-)


next up previous
Next: Measurements and Results Up: Installation Instructions Previous: Patch the kernel
Haoqiang Zheng 2003-07-22