Rule-based Classification Engine (RBCE)
-------------------------------------------

The ckrm/rbce directory contains the sources for two classification engines
called rbce and crbce. Both are optional, built as kernel modules and share much
of their codebase. Only one classification engine (CE) can be loaded at a time
in CKRM.


With RBCE, user can specify rules for how tasks are classified to a
class.  Rules are specified by one or more attribute-value pairs and
an associated class. The tasks that match all the attr-value pairs
will get classified to the class attached with the rule.

The file rbce_info under /rcfs/ce directory details the functionality
of different files available under the directory and also details
about attributes that can are used to define rules.

order: When multiple rules are defined the rules are executed
	   according to the order of a rule. Order can be specified
	   while defining a rule.  If order is not specified, the
	   highest order will be assigned to the rule(i.e, the new
	   rule will be executed after all the previously defined
	   evaluate false). So, order of rules is important as that
	   will decide, which class a task will get assigned to. For
	   example, if we have the two following rules: r1:
	   uid=1004,order=10,class=/rcfs/taskclass/c1 r2:
	   uid=1004,cmd=grep,order=20,class=/rcfs/taskclass/c2 then,
	   the task "grep" executed by user 1004 will always be
	   assigned to class /rcfs/taskclass/c1, as rule r1 will be
	   executed before r2 and the task successfully matched the
	   rule's attr-value pairs. Rule r2 will never be consulted
	   for the command.  Note: The order in which the rules are
	   displayed(by ls) has no correlation with the order of the
	   rule.

dependency: Rules can be defined to be depend on another rule. i.e a
	   rule can be dependent on one rule and has its own
	   additional attr-value pairs. the dependent rule will
	   evaluate true only if all the attr-value pairs of both
	   rules are satisfied.  ex: r1: gid=502,class=/rcfs/taskclass
	   r2: depend=r1,cmd=grep,class=rcfstaskclass/c1 r2 is a
	   dependent rule that depends on r1, a task will be assigned
	   to /rcfs/taskclass/c1 if its gid is 502 and the executable
	   command name is "grep". If a task's gid is 502 but the
	   command name is _not_ "grep" then it will be assigned to
	   /rcfs/taskclass

	   Note: The order of dependent rule must be _lesser_ than the
	   rule it depends on, so that it is evaluated _before the
	   base rule is evaluated. Otherwise the base rule will
	   evaluate true and the task will be assigned to the class of
	   that rule without the dependent rule ever getting
	   evaluated. In the example above, order of r2 must be lesser
	   than order of r1.

app_tag: a task can be attached with a tag(ascii string), that becomes
	   an attribute of that task and rules can be defined with the
	   tag value.

state: states are at two levels in RBCE. The entire RBCE can be
	   enabled or disabled which writing 1 or 0 to the file
	   rbce_state under /rcfs/ce.  Disabling RBCE, would mean that
	   the rules defined in RBCE will not be utilized for
	   classifying a task to a class.  A specific rule can be
	   enabled/disabled by changing the state of that rule. Once
	   it is disabled, the rule will not be evaluated.
