User defined rules

There are many instances in the Scheduler where you can choose from one of several decision rules listed in the drop down list and described in the online help messages. An example of this is a resource sequencing rule where you can choose from FIFO, LIFO, or several other rules to order requests as they are placed in the resource request queue. Notice that there are a number of rules listed as “user defined”. A user defined rule is a piece of customized logic that you can write to make decisions.

For every rule that you want to install, you must write one or more functions in C. To execute correctly, these functions must accept the proper arguments and return the proper value for the type of rule. The names of these functions must not conflict with the names of standard system functions; Section 3 describes the standard user-writable functions in detail, and the user-callable functions are described throughout this document, can be found in factor.h (see Section 3.2), and are listed in Section 6. The functions that you write are made accessible to the Scheduler by calls to installation functions in the initialization function ucini1.

The details of the rules that you can write are in the following subsections. The name of the installation function corresponding to each rule is given also. The details of installation and initialization function ucini1 are given in Section 4.2.

A fragment from ucini1 for installing a function for resource sequencing rule 39 is:


double sqrl39(LOAD*);

void ucini1()
{
   sedfrk(39, sqrl39);

   /* Install the rest of your first user-initialization
    customized logic here. */
}

In the following subsections user-installable rule functions are shown. The names of these functions are only suggestions and do not have to be used. Following the suggested name, the suffix of “**” is used to represent a number of the rule that the function defines and should be replaced accordingly. An example is shown in each installation fragment where “**” is replaced by “39”.