Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 33
Controlling Which CPU a Process Can Run In
! Accept if operator group:
BEGIN
LOGON^REPLY.REPLYCODE := 0;
LOGON^REPLY.REPLYTEXT ':=' LOGON^TEXT FOR
LOGON^TEXT^LEN;
END;
END
! Accept if REFUSE^ALL = NO:
ELSE
BEGIN
LOGON^REPLY.REPLYCODE := 0;
LOGON^REPLY.REPLYTEXT ':=' LOGON^TEXT FOR
LOGON^TEXT^LEN;
END;
CALL REPLYX(LOGON^REPLY,$LEN(LOGON^REPLY));
END;
Controlling Which CPU a Process Can Run In
You can write your command-interface program to send information to the $CMON
process indicating which CPU the process should run in. The following example
expands the example given earlier for grouping processes according to their priority
and having processes that need a priority response use one group of CPUs while
those processes that are not so response-critical use the remaining CPUs. In this
case, the operator is allowed to change the status of CPUs between priority response
and non-priority response at run time.
This example is built around a table of CPUs in the $CMON process called the
CPU^LIST. This is an integer array giving the response status for each CPU.
CPU^LIST[0] represents CPU 0, and it is set to 1 if it is part of the priority-response
group of CPUs or 0 if it belongs to the non-priority-response group of CPUs.
CPU^LIST[1] represents CPU 1, and so on.
To change the status of a given CPU, the command-interface program formulates a
message made up of the message code 62, the CPU number, and the new status.
Then it sends the message to $CMON. On reading a message 62, $CMON updates
the CPU^LIST accordingly.
When $CMON receives a Processcreation^msg message from a TACL process, it
checks the priority and assigns the process to the priority or nonpriority group.
$CMON then checks the CPU^LIST to find the next CPU allocated to the particular
group. $CMON then puts that CPU number into the Processcreation^accept structure
and returns the message to the TACL process.