Performance Optimization of FMS on RSX-11M + ___________ ____________ __ ___ __ _______ Kevin McCabe Software Services Digital Equipment Corp. The Problem + ___ _______ There is currently a recognized set of problems that evolve from using FMS with Cobol (and other languages that use RMS) under RSX-11M (RSX-11M+ and IAS). It has to do with the requirement that these tasks must be built with RMS support. Under normal circumstances this implies that the RMS routines will be placed in a shareable resident library. Yet there is a restriction that applies to the tasks that are built to use this RMS resident library. It is the fact that RMS, when itself resident, will not allow calls to be made to another resident library. This restriction prevents applications from accessing FMS routines through a second resident library. Since no FMS resident library can be accessed, the problem that results is that each Cobol task using FMS will require 6-9 kilobytes more memory for the FMS routines. Under normal conditions this would not be a problem (there have been many programs written that require considerable amounts of a systems resources) since most operating systems provide the means for handling large task images. The major obstacle involved in this situation is that restrictions on the use of FMS preclude most of these handling features. The restriction in question is that FMS does not allow a program to checkpoint while it is doing I/O. This of course is a valid limitation since a program that uses FMS will be doing single character interrupts. If the program were allowed to checkpoint the overhead involved would grind the processor to a halt in a very short period of time. Therefore the problem must be dealt with on a more imaginative level. Ways of Getting Around This Problem + ____ __ _______ ______ ____ _______ There appear to be many solutions to this problem. Almost all of which require that the main Cobol program be segmented into a number of smaller tasks. Ways of accomplishing this feat range from simply separating the program by specific functions, to writing a high level language interface that will dispatch FMS calls to a separate task that will preform the screen interaction independent of the main program. Stage One -- Splitting into Two Sections: FMS I/O and Main Task + _____ ___ _________ ____ ___ _________ ___ ___ ___ ____ ____ The first is the easiest to implement and hence the least functional. The procedure is to write two seperate programs, the first being the Cobol program itself. The second is a program written to do only the FMS I/O. The I/O program is started, acquires the needed information, places it into another data file and activates the larger program, making itself go away when complete. Advantages: The advantage is that there is now a section that can be checkpointed (the main program) and an FMS I/O section that will only be in memory as long as needed. Disadvantages: The disadvantages are obvious. The program must be written in two sections, all the information needed by the program must be acquired in one fell swoop and the FMS task still cannot checkpoint. Stage Two -- A Non-RMS FMS Task. + _____ ___ _ _______ ___ _____ The next degree of functionality added can remedy some of this. This would require that the first task be written in a language that does not use RMS. The data could then be placed in a COMMON region and captured by the second task. Advantages: This allows the use of a resident FMS library and the I/O task will not occupy much memory, alleviating checkpointing as a limitation. Disadvantages: The problems with this are that the program must be written in two separate languages. The memory trade off between the common region and shareable library should favor the space saved by multiple tasks. A form of protocol must be developed for access to the common region. Other limitations are still in effect. Stage Three -- Multiple FMS I/O Tasks + _____ _____ ________ ___ ___ _____ There is still a problem acquiring information at more than one point in the program. This can be solved by writing a small task to aquire information for each stage of the main task. The situation will then require a method of starting and stopping the needed images. This can be done by writing a small routine to SPAWN tasks from the main Cobol program. Begin by starting the main program, and when I/O is required SPAWN the appropriate task. That task then STOPs (suspending the task will also work but checkpointing will be priority based) the parent and attaches the keyboard. Information can then be passed back to the main routine by the disk or common methods described above. Another method of passing information from Parent to Child is through a predefined task to task communication protocol (for those of you lucky enough to have DECNET on the system, communication can be done between tasks with DECNET protocol and communication facilities which allow larger packets to be transmitted). Advantages: The advantages of this method are many. First the major sections of the main program can be checkpointed allowing more tasks to fit into memory. Second the FMS routines can be made resident (if the SPAWNed routine is in a non RMS language) and the calling I/O routines are only resident when needed. Both of these refinements save memory. Disadvantages: The problems with this method are that the programmer must write a separate task for each I/O acquisition section of the program that will transmit (and receive if need be) information to the parent task. Also the system will need directives not often generated into the system monitor, such as SPAWN or the PLAS directives (if a Create Region is used for data transmission). Stage Four -- One SPAWNED FMS I/O Task for Many Requests + _____ ____ ___ _______ ___ ___ ____ ___ ____ ________ Taking this solution one step further a separate task could be written to handle ALL spawn requests. This task could be started once by the parent and all requests could be made through the single task. The function of this task would be to STOP and UNSTOP the parent and use the FMS routines to acquire and/or display screen information. Advantages: This allows a single task to use a predefined protocol to do the screen interaction, freeing the programmers from the inconvience of writing a separate routine for each specific set of calls. Disadvantages: The calls will still not be as simple to use as the normal FMS calls, nor will they be of the same form as standard calls. Stage Five -- A Transparent Two Task Structure + _____ ____ _ ___________ ___ ____ _________ The last and possibly most sophisticated form of this entity would be the writing of a special high level language interface for the Cobol FMS routines. The solution in theory is the same as for the single SPAWNed routine above. The addition will only allow the Cobol programmer to use the standard FMS calls in their normal form. The proceedure would be to write a MACRO (or possibly FORTRAN) interface to link with the Cobol image. The purpose will be to define a set of symbolic entries for each of the calls. The spawned task must attach the FMS RESLIB and set up all the pointers (as defined in section 5.11 of the FMS Software Reference Manual) for such things as the channel and impure area location pointers (defined within the SPAWNed task). When the call is made from the Cobol program an arguement list is set up. The form of this list has R5 pointing to a word that contains a 0 in the high byte and the number of arguements in the low byte. The addresses of the arguements follow. The parent must then UNSTOP the child and pass the information to it, then stop itself. The child will then make the FMS macro calls to the RESLIB and UNSTOP the parent. Information will be passed back (thru the interface) to the parent and the child will be STOPped. Advantages: The some of the advantages that these routines will provide are obvious. They can save memory. They will decrease average task size allowing a better fit for memory partitions. They can allow checkpointing of large tasks that would not normally be allowed to checkpoint. System performance will increase and make it possible to fit more FMS jobs on a system. Depending on the method used and the programs involved a user may or may not benefit from these work arounds. The choice of what to do and how to do it are left entirely up to the applications programmer. Another advantage of this last technique is that it preserves application program compatibility with standard FMS applications. This means that if Digital should come out with an architecturally based systems solution to the performance problems addressed here, applications could be upgraded from this last variety of the user work-around to the improved Form Driver by merely re-Task-Building. Disadvantages: As with many of the solutions the PLAS and SPAWN direcives may have to be generated into the system. This is also a great deal of work that may not result in enough savings to cover the cost of the time. Additional Benefits. Another point to make note of is that these routines also provide a path for implementing features not currently provided by FMS. Such application dependent functions as task timeout, multiple terminal slave applications (add a slave index to calls, one spawned task per slave) and shareable database lookup systems can utilize the outlined procedures as well.