Using the C program unit ADJTCLT (adjust tac class), users can control how the processes (tasks) are distributed to the TAC classes in the light of the current total number of processes and the current number of asynchronous processes. To do this, the user creates a table containing the desired settings, see section "Creating a TAC class table".
The program is supplied as a full dialog and asynchronous program unit.
On Unix, Linux and Windows systems, ADJTCLT forms part of the sample application or of the Quick Start Kit.
The program makes it possible to:
Automatically adapt the number of TAC class processes in accordance with the table. This function is always executed.
Read in a new table with a default name, see section "Sample table". This function is executed if no table has as yet been read or if the operation code RF or READFILE is specified.
Read in a new table with any name. This function is executed if the operation code RF or READFILE is specified.
Modify the currently permitted number of asynchronous tasks. This function is executed if the operation code MA=ttt or MAXASYN=ttt is specified, where ttt is the desired maximum number of ASYNTASKS.
Because modifying the number of permitted tasks for asynchronous processing does not generate any messages, the change must not be made directly using the KDCAPPL command but must instead be performed via the interface provided by this program in order to adapt the TAC class settings.
If only one dialog TAC is generated for the program unit then all the functions must be started manually, i.e. the program must be called manually whenever the number of tasks or asynchronous tasks or the table has been changed.
For information on how to call the program automatically by means of the asynchronous TAC, see section "ADJTCLT as MSGTAC or MSG-DEST program unit".
Creating a TAC class table
In this table, you specify the number of tasks per TAC class as a function of:
the number of running processes
and the current setting for the maximum number of processes that may be used for asynchronous processing.
The table must be saved as a text file. It can, for example, be created in Microsoft Excel and then be saved as a tab-separated text file. Spaces are also permitted as separators.
Sample table
A sample table with the following default name is supplied for all platforms:
BS2000 systems: ADJTABLE.TXT
You will find this sample table in the library SYSLIB.UTM.070.EXAMPLE. Before the program unit can use this table, you must copy it to the user ID under which the UTM application is running. In UTM cluster applications, all the node applications can use the same table if the file is located in the shared pubset.
Unix, Linux and Windows systems: AdjTable.txt
On Unix, Linux and Windows systems, the table forms part of the sample application or of the Quick Start Kit. Following the installation of the sample application or the Quick Start Kit, the table can be found in the following subdirectory of the sample application or Quick Start Kit:
utmsample/utm-c
(Unix and Linux systems)utmsample\utm-c
(Windows systems)
Structure of the table
The following rules apply to the structure of the table:
The values must be entered as printable numbers.
The first row in the table can be a title line.
All subsequent rows must have the following identical structure:
Column 1: Number of running processes. The maximum number of processes is 240.
Column 2: Current setting for the maximum number of processes that may be used for asynchronous processing.
Column 3 onwards: Number of processes for each TAC class in ascending order, e.g.
17 2 4 3 3 ... 0 0 0 1 1 1
Row 3 corresponds to TAC class 1, row 4 to TAC class 2 etc.
The following applies to each of these rows:
The number of processes in row 1 must be greater than the total number of processes for all dialog TAC classes (1 - 8) plus the number of asynchronous processes. The greater this difference is, the more free processes there are for performing other tasks.
In the case of unused dialog TAC classes, it is also possible to specify 0 as the number of processes even though the minimum value for the number of processes for dialog TAC classes is 1. Reason: If this were not the case, the minimum number of processes for the application would be 9 (8 dialog TAC classes + 1).
You should note that the program is not able to check whether these dialog TAC classes are genuinely unused.
The values for the TAC classes can also be omitted. In this case, the default value 0 is used for dialog TAC classes and the default value '-' for asynchronous TAC classes. '-' for asynchronous TAC classes means that the number of tasks for this TAC class is unchanged.
The number of processes (column 1) must be sorted in ascending order in the table, while the numbers of asynchronous processes for which there are the same numbers of processes (column 2) must be sorted in descending order.
Only the maximum permitted number of asynchronous processes, but not the number of processes permitted for the individual TAC classes, has an influence on the number of required processes. This is ignored if the number of permitted tasks for the individual asynchronous TAC classes is smaller than the maximum permitted number of asynchronous tasks.
Example
Extract from a table specifying that if there are 10 or fewer processes then one process, and if there are 12 or more processes then two processes must always be reserved, and in which only dialog TAC classes 1, 2 and 3 are used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The program starts the search at the last entry in the table and selects the table entry for which the following two conditions are satisfied:
The number of running processes must be greater than or equal to the number in column 1.
The difference between the number of currently running processes and the currently set maximum number of asynchronous tasks must be greater than or equal to column 1 - column 2. This condition ensures that the minimum number of processes that are free for dialog processing is actually greater than the sum of the numbers of processes in the dialog TAC classes.
If an entry is found then the program performs the following calculation:
Number of available dialog processes = Column 1(All) - Column 2 (Asyn)
Example
If there are 12 processes and 7, 6, 5 or 4 asynchronous processes then the following row is selected:
12 7 1 1 1 ... 0 0 0 0 3 4
If there are 12 processes and 8 asynchronous processes then the following row is selected:
6 2 1 1 1
Of the 12 running processes, 4 are always free for dialog processing since a maximum of 8 processes are occupied by asynchronous processing. Of these 4 processes, a maximum of 3 are occupied by dialog processing (sum of the processes for the dialog TAC classes 1+1+1). There is therefore always one process free.
If there are 12 processes and 9 asynchronous processes then no suitable entry is found.
If a suitable table entry is found then the number of processes for the individual TAC classes is adapted in accordance with the table.
In the case of TAC classes generated with PGWT=YES, the number of processes must not exceed the generated maximum number TASKS-IN-PGWT.
If the number of processes in TAC classes generated with PGWT=YES exceeds the maximum permitted number TASKS-IN-PGWT then the smaller value is used.
ADJTCLT as MSGTAC or MSG-DEST program unit
The asynchronous program variant of ADJTCLT can also be used as a MSGTAC or MSG-DEST program. An existing MSGTAC program can (after being adapted, if necessary) be integrated in the program unit. However, ADJTCLT cannot be used as a subprogram of an existing MSGTAC program.
ADJTCLT as MSGTAC program
If ADJTCLT is only generated as a MSGTAC program then only those functions that do not require an operation code are available since the MSGTAC program run is exclusively event-driven and the program cannot be called via a TAC.
In this case, there must be a separate application message module and the messages K052, K056 and K058 must have the message destination MSGTAC.
ADJTCLT as MSGDEST program
In the case of message-driven processing, the asynchronous TAC can also be generated as a MSG-DEST (MSG-DEST USER-DEST-1/2/3/4, NAME=, DEST-TYPE=TAC, ...) and be used in the user message module as USER-DEST for messages K052, K056 and K058.
However, a message-driven program unit only runs independently of the number of asynchronous processes and TAC class control if it has been generated as a MSGTAC program. Otherwise the following applies:
There must always be at least one process that is permitted to perform asynchronous processing.
At least one process must be permitted in the program unit's TAC class.
Notes on generation
The program unit must be defined as follows in the KDCDEF run:
PROGRAM ADJTCLT, COMP=ILCS
(BS2000 systems)PROGRAM ADJTCLT, COMP=C (
Unix, Linux and Windows systems)
Generation as dialog and asynchronous TAC:
TAC ADJTCLT, PROGRAM=ADJTCLT, ADMIN=YES, TYPE=D
TAC ADJTCLTA, PROGRAM=ADJTCLT, ADMIN=YES, TYPE=A
Generation as MSGTAC:
TAC KDCMSGTC, PROGRAM=ADJTCLT, ADMIN=YES, TYPE=A
The asynchronous TAC ADJTCLTA can be generated as follows as MSG-DEST for, e.g., USER-DEST-1.
MSG-DEST USER-DEST-1, NAME=ADJTCLTA, DEST-TYPE=TAC , MSG-FORMAT=PRINT
On Unix, Linux and Windows systems, you can also take over the KDCDEF statements from the sample application or the Quick Start Kit into the generation of the UTM application.
Notes on linking
On BS2000 systems, the program unit ADJTCLT can be linked to the application program by means of a RESOLVE-BY-AUTO statement. This also implicitly links the routine ERRCHCK.
On Unix, Linux and Windows systems, the program unit ADJTCLT is automatically linked to the sample application or the Quick Start Kit.