SILK CPU Scheduling API

The SILK CPU scheduler provides isolation between slices (vservers) using proportional sharing. Each slice is assigned one or more shares, and all of its processes are scheduled based on this share assignment. A slice can be allowed to consume unused CPU capacity in proportion to its share, or it can be rate-limited to consume no more than its share of the CPU (e.g., if a slice has reserved 10% of the total shares, it is limited to 10% of CPU cycles). Currently, the processes belonging to a slice are scheduled round-robin within its CPU share.

The following files are found in /proc/scout/cpu. Note that only root can write to these files:

slices
'cat' this file to see info on current slices. The following shows that there are three outstanding slices: 556, 606, and the "system" slice. The shares column shows how many shares have been assigned to each slice. The procs column shows how many processes have been bound to that slice (see processes file below). Finally, the cycles column shows how many cycles have been charged to that slice since system boot:
$ cat /proc/scout/cpu/slices
slice   shares  procs   cycles
606     1       3       4625054
556     1       1       461485084106
system  1       0       3128398202630
Note that the "system" slice is created by default, and all process activity not associated with a slice that has its own share reservation is charged to this slice. A slice that has been rate-limited will have its share displayed in parentheses.

reserve
Assign shares to a slice by writing to this file, e.g., 'echo 758 50 > reserve' assigns 50 shares to slice 758. A slice can also be limited to consume no more than its reserved rate by assigning it negative shares: 'echo 758 -50 > reserve' limits the slice to 5% of the CPU, assuming that there are 1000 shares total (see info file below). Specify slice 1 to change the share of the "system" slice.

release
Remove all shares for a slice, e.g., 'echo 758 > release' removes the share reservation of slice 758. The "system" slice cannot be removed.

info
'cat' this file to see scheduler information. This shows the rate at which the scheduler thinks the CPU is running, how many total shares there are, and how many are still available.
$ cat /proc/scout/cpu/info
CPU speed: 1263 MHz
Total shares: 1000
Avail shares: 999
By default there are 1000 shares to start with, and therefore 1 share = 0.1% of CPU = 1.26 MHz on this machine.

idle
How many cycles have been charged to the idle process.

overhead
How many cycles have been spent within my scheduling algorithm.

processes
Shows which processes have been bound to a slice in the scheduler. The binding is lazy in that it does not take place until the process is put on the run queue, so not all processes owned by a slice may show up in this file.
$ cat /proc/scout/cpu/processes
slice   pid     status
606     23770   Running
606     22962   Blocked
606     22961   Blocked
556     4977    Blocked
Note that processes bound to the "system" slice are not displayed.

timeslice
How many jiffies (1 jiffy = 10ms) a process is allowed to run. Currently the default is 5 (i.e., 50ms timeslices), but it can be changed by writing a new value to the file.


Copyright © 2003 Andy Bavier