Find it

Thursday, July 30, 2009

Fair Share Scheduler

Fair Share Scheduler
Before zones, the Fair Share Scheduler (FSS) was used to control how many CPU cycles are assigned by the system to active applications or workloads.The administrator could create projects to identify those workloads and assign CPU shares to them. The FSS scheduler, if used, would then guarantee that if these projects compete with each other for the same set of CPUs, each project would get a fraction of all CPU cycles that is proportional to the ratio between its number of shares and the total amount of shares given to all other active projects.

NOTE: The FSS scheduling class is not enabled by default.The FSS scheduler can be set to be the default scheduling class for the whole system by using the -d option for dispadmin command and rebooting:

global# dispadmin -d FSS
global# reboot

If reboot is not desireable, then all processes can be manually moved to the FSS scheduling class by using priocntl command:

global# priocntl -s -c FSS -i class TS
global# priocntl -s -c FSS -i class IA
global# priocntl -s -c FSS -i pid 1

you can run the following command and look at the 4th column:

global# ps -cafe
root 101050 101039 FSS 59 17:14:59 ? 0:00 /sbin/init
root 101169 101167 FSS 29 17:15:07 ? 0:00 /usr/lib/saf/ttymon

If you want to use FSS to divide CPU cycles between zones, here's what you need to do. You can assign shares to zones permanently with zonecfg command, or change the assignment dynamically with prctl command. Both of these operations can be only done from the global zone. In the following example, zone "zone1" gets 15 shares statically assigned to it with zonecfg command:

global# zonecfg -z zone1
zonecfg:zone1> add rctl
zonecfg:zone1:rctl> set name=zone.cpu-shares
zonecfg:zone1:rctl> add value (priv=privileged,limit=15,action=none)
zonecfg:zone1:rctl> end
zonecfg:zone1> exit

This way, CPU shares will be automatically assigned to the zone at zone boot time. If the zone is already running, CPU shares can be assigned to it without rebooting by using prctl command:

global# prctl -r -n zone.cpu-shares -v 15 -i zone z1

To confirm that the number of CPU shares has changed, prctl can be used from within zone "z1":

z1# prctl -n zone.cpu-shares $$
process: 101439: zsh
privileged 15 - none -
system 65.5K max none -

1 comment: