Method of exchanging data between programs in a data processing system

Abstract: Disclosed is a method of facilitating program to program communication within memory space managed by a given processor. Sender programs communicate with receiver programs via an intermediate communication facility pro­ gram acting as a central "post office" for the senders and receivers. Receiver programs identify themselves to the communication facility program by registering their iden­ tification and status therewith. Thereafter, any sender programs can send messages or data to any receiver pro­ grams which have been defined to the communication facili­ ty program. Senders need not be defined to the communica­ tion facility program but need only request delivery of data or a message to a targeted receiver.

Description: This invention relates to computer programming techniques and particularly to a method of exchanging data between programs in a data processing system. A variety of program to program communication techniques are known. For example, the IBM program to program communication facility is of this type. To use this facility, a user program must first be defined in a table and sender and receiver programs must establish a "session" before they can begin communicating with one another. When a receiver program wishes to communicate by receiving data from more than one sender program, it has to maintain an individual "session" with each of the partner sender programs. If the session established is broken, or if the receiver program becomes no longer active, the sender program cannot send data and thus may reach an impasse in its own operation. Additionally, in this type of system, a communication session can only be used in a half duplex mode, i.e. in a unidirectional mode at any time. For example, when program A is sending data to program B, program B cannot send data A on the same session at the same time. In order to send data, Program B must first receive the data from Program A, then request permission to send, receive permission to send and then begin sending data to program A. In other words, the communication session has to be turned around to redefine sender and receiver. Additionally, under this system, a sender program can only send one data buffer of information to a receiver program at a time and then must wait for the receiver program to receive that buffer full of information before it can send another data buffer of information. In the communications field in general, a potential solution exists for machine to machine communications in the form of a "post office box" in which designated machines can communicate with each other by leaving messages for one another in a commonly accessible memory. Such a system is described on page 204 of the article "Computer Interconnection Structures: Taxonomy, Characteristics, and Examples" by George A. Anderson and E. Douglas Jensen appearing in Computing Surveys, Vol. 7, #4, December 1976, pages 197-213, although no specific implementation is described. A specific implementation of this type of system is shown, however, in Electronic Design, Vol. 5, March 1, 1975, pages 52-57, at page 54 Figure 4 where master to master communication between microprocessors may be facilitated by a common memory. In such systems, the communication between the elements is predetermined by each master microprocessor. Each master is able to contact another processor or processors when it needs to communicate directly via the common memory. Each processor gains access to the common memory by some fixed priority scheme to avoid conflicts over the use of the memory bus. A processor that gains access to the common memory, locks out all other would-be communicators. It knows by prior arrangement the location of a "mail box" for the desired target recipient and the sending program indicates to which other master processor it wishes to communicate a message by placing a status or alert character within the desired recipient's "mail box". The communicating processor must either deposit the information to be communicated into a known fixed area of common memory or indicate the location and length of the message that it has stored. When the communicating processor has set up the transfer, it signals to the other constituents that the transfer is to take place by use of a common on-system interrupt received by all processors. While these systems exhibit some similarity in concept to the invention to be described herein, it will be noted that each processor is required to know the location of intended recipient processors, must be able to gain access to a bus, will lock out communication from any other contenders, must know the location in memory where intended messages are to be stored or must have a means of indicating (to any intended recipient) where they are stored, and then must notify each of the other processors that a message awaits one of them so that, upon later checking, the desired recipient will learn that it has information in its "mail box". These are significant drawbacks since the sending processor must have a full knowledge of the system, i.e. the identities of other processors and their assigned spaces in "mail box" memory and must have a means of communicating generally with the other processors outside the realm of the mail box in order to alert them that a message awaits. A system that overcomes the need to know the destination processor is found in US 4 630 196 patent document by Bedner Jr. et al. In this system a store and forward transfer facility accepts messages from an originating process and notifies a receiving process that a message is pending. The message is delivered subsequent to a request from the destination process. In view of the foregoing difficulties with prior art systems for program to program or processor to processor communication, it would be most desirable if the requirement for identifying senders and receivers and for establishing a session and providing controls over such a communicating session could be avoided. It would also be desirable to facilitate a full duplex mode of communication rather than a half duplex mode inherent in the aforementioned prior art. The capability of sending to an inoperative receiver would also be highly useful, since it would avoid having a sender await availability of the desired recipient. In light of the foregoing known deficiencies with the prior art, it is an object of this invention to provide an improved method of program to program communication operative within the context of a data processing system for facilitating data exchanges between senders and receivers in a full duplex mode. The preferred embodiment of the present invention as claimed is implemented by providing a program to program communication facility which itself may be a program resident within memory and executable by a processor. Within the same memory, sender and receiver programs may be defined to exist. A sender program, having a buffer of data known to be desired by a receiver, or which the sender desires to deliver to the receiver program may simply be delivered to the program to program communication facility program in the same manner that an addressed piece of mail is delivered to a post office for eventual delivery. The sender program does not have to await the availability of its intended receiver and does not have to know the physical location where the intended receiver may reside. All that is required is that each receiver program must register itself with the program to program communication facility program. Thus no "sessions" are established. Receivers merely register their availability and identification with the program to program communication facility. Then when messages destined for a given receiver are transmitted by a given sender to the program to program communication facility, the communication facility stores the messages in "mail boxes" to be later retrieved by receiver programs when they are alerted by the program to program communication facility that a message awaits them. The preferred embodiment will be described in greater detail with reference to the drawings in which: Figure 1 illustrates the architectural layout and flow of messages from a first program resident within an area of memory within a computer system to a communication facility program resident within another area of the same memory and from the communication facility program to a receiver program also resident within the same memory. Figure 2 illustrates a detailed flow chart of that portion of Figure 1 denoted as program A. Figure 3 illustrates a flow chart for that portion of Figure 1 denoted as program B. Figure 4 illustrates that portion of Figure 1 denoted as program C. Figure 5 is the detailed flow chart of that portion of Figure 1 denoted as program D. Figure 6 is that portion of Figure 1 denoted as program E. Figure 7 is the detailed flow chart for that portion of Figure 1 denoted as program F. Figure 8 is the flow chart for that portion of Figure 1 denoted as program G. It will be appreciated by those of skill in the art that the preferred embodiment of the invention as claimed that will be described shortly may be applicable not only to program to program communication techniques within a single computer, but might be utilized to facilitate computer to computer communication techniques as well. In general, the system of the preferred embodiment of the invention involves senders, receivers and an intermediate agent generally described as the "communication facility". In the preferred embodiment that will be described, the senders and receivers are assumed to be application programs resident within memory in a single computer system and the intermediate communication facility to which messages are delivered and from which they are retrieved is also a program resident within the same computer system memory. The process of communication is relatively simple. A receiver must first register itself with the communication facility program just as mail recipients must register with the post office. The receiver issues an initialization request to the communication facility to establish its identity and to alert the communication facility that it exists and is available for the receipt of messages. The receiver may specify whether it is to receive messages from any sender or only from certain categories of senders, may specify a limit for the number of data buffers of information that should be held in a queue, and can retrieve its data for processing whenever it is ready to do so. A transmitter or sender program must issue a transmission request command to the communication facility to inform the communication facility that a data transfer task is to be done. The communication facility program either accepts or rejects messages from senders depending upon whether it realizes that the intended recipient is present in the system. The communication facility also notifies the intended receiver that a message awaits it and it notifies the transmitter of the specific receiver's status at the time, i.e. whether it is available and receiving messages or whether it is not registered with the communication facility. To obtain messages, a receiver issues a request to receive to the communication facility which then copies an awaiting message to a location specified by the receiver in the receiver's memory. In this technique, it may be readily appreciated that the process is asynchronous in that the sender and receiver do not need to be synchronized with one another; it is also clear that a full duplex mode of message exchanges is possible with both the sender and the receiver simultaneously delivering messages for one another to the intermediate communication facility. Each sender or receiver always presents a request command to the communication facility to begin its transmission or reception. Any transmitter can send a message to the communication facility without having preregistered itself, since it is only the receivers that need to be registered. The communication facility, much like a post office, will accept messages or reject messages depending upon whether the intended recipient is known to it or not. This technique avoids the use of intermediate controls in the form of "system session" establishment and allows any program to send to a given recipient program without setting up a session therewith. In addition, the program can send as many messages as it desires and does not have to await reception by the intended receiving program. A sender program can even send data to a receiver program when the receiver program is not currently running, although it is registered with the communication facility program and resident in the system. The communication facility program can accept and hold data for an intended receiver and return a status code to notify the sender program that the receiver is not currently active. A variety of other capabilities and advantages will become apparent as this discussion continues. A preferred embodiment of the invention will be described with reference to an environment in which senders, receivers, and the intermediate communication facility are all computer programs resident in various individual areas of the same memory within a computer system serviced by a processor. The processor may have multitasking capability, i.e. the capability of running several programs simultaneously, or may not. The chief requirement is that all of the programs exist within memory space handled by and accessible to the same computer system. If computer to computer communication is desired, then at least the communication facility program must reside in the computer that will be handling the "post office" functions for other computers that wish to access one another via this method. The preferred embodiment, however, exists within an architectural setting as shown with reference to Figure 1. In Figure 1, a sender program is depicted to exist within a defined area #1 of computer system memory and a receiver program is defined to exist within an area #2 of the same computer system memory. The sender and receiver programs may be different user programs which have a need and/or desire to exchange data buffers of information with one another for purposes of facilitating computations to be carried out or additional tasks to be performed in response to results provided by one or another. The intermediate communication facility program also resides within yet another defined area of the same memory served by the same processor. As shown in Figure 1, the sender program initiates the process of sending by issuing a "call program X Request Parameter Buffer". This is a high level standard programming call interface with specific Request Parameter Buffer contents or fields as described in Table 1. This type of communication facility can be used generally with any high level or assembler programming language having the capability of supporting a standard program call interface. The requirements and functional capabilities of the call interface will be described in greater detail herein. It must be noted that, in the following description, programs B,C,D,E,F, and G are parts of the communication facility. For program A, only the Call Facility portion is a part of the communication facility. As shown in Table 1 above, the request parameter buffer (RPB) fields have arbitrarily defined byte format meanings, all of which will be defined in greater detail herein. The call facility is actually implemented by Program A as shown in Figure 1 and is executed whenever the user program issues a CALL to use the communication facility. Program A is defined in greater detail in Figure 2; however, Program A is executed whenever the user program, i.e. a sender or a receiver program issues a call command. Program A will check to see if the intermediate communication facility program and Program B are active and will, if Program B is active, cause Program B to be executed at once. Otherwise, a return code will be set and Program A will regain control and notify the user program that the communication facility is not available at this time. The general flow for operations will be conducted with respect to the schematic shown in Figure 1. Assuming that Program A's check of availability for the intermediate communication facility program and Program B are positive, Program B will be executed. Program B performs the following processes. First it validates the user request type as a type that is recognized by prior arrangement. It also verifies that the user program is an authorized program (if it is a request of the type that requires authorization as will be described in greater detail later). Also, if the user's request requires a check on a given receiver, Program B will verify to see whether the receiver has been defined at the communication facility and whether it is currently active or not. Program B will also check to see whether a user program's request is to set a receiver inactive and will verify that the intended receiver has, in fact, already been defined in the communciation facility memory area. If the user program's request is to send a data buffer, Program B verifies that the intended receiver has been defined already in the memory area assigned for the communication facility. If the user program request is to send an alert to a network management program, Program B verifies that the management program has been defined as a receiver in the communication facility memory area. Also, Program B will verify that a sender program is an APF authorized program when a user program's request is to send a data buffer of information to a receiver program which is initialized as an authorized receiver. Additionally, Program B establishes a recovery routine if it is requested. This routine, if an abnormal termination occurs, will be executed and will return control to the requesting user program. Depending upon the type of request presented by the user program, Program B will execute the communication facility program resident within the intermediate memory Program C, D and E depending specifically upon the particular request type. Program C is executed in response to actions taken by Program B to process user requests of certain types 12 and 14 that will be described in greater detail later. Program C obtains a data storage area within the intermediate memory area of the communication facility program for holding the user's data buffer of information. Program C then copies the user's data buffer information from the user memory area of the sending program into the intermediate memory area of the communication facility program. Then, if the intended receiver program is active and the receiver's execution control block has not been set to indicate that a message awaits the given receiver, the receiver's control block will be set to so indicate. Program D as shown in Figure 1 may be executed by Program B to process requests from user programs of type 22 as will be described later. This is the type of request which is presented to request retrieving a data buffer of information previously stored in a buffer queue for a given receiver program. Program D checks the receiver buffer queue within the communication facility program memory area to see if there is a message available for reception. It will also check to see if whatever buffer length has been specified by the receiver program is large enough to hold the incoming data buffer contents. It will then copy the data buffer contents in the intermediate memory of the communication facility program over into the receiver program's memory area and will release the data buffer storage for reuse in the communication facility memory area. Program E will be executed by the Program B in order to process user program requests of types 4 and 9. If the request from the user is to set a receiver to an inactive state, request type 9, then Program E sets the receiver status to not active. If the request is to define or initialize a program as a receiver, request type 4, and the receiver has already been defined, it sets the receiver status to active but if the receiver has not already been defined, it will perform the initialization for the receiver and set the status active. Program F is executed by the system whenever a user task or memory area is terminated. If the terminating task matches that of one of the defined receivers, the receiver's status will be set to not active and if the terminating user's memory area matches one of the receivers, the receiver's status will also be set to not active. Program G is executed by the system when the intermediate memory area is being terminated. It notifies all active receivers by posting a code in the receivers' ECBs that notifies them that the intermediate memory area is terminated. The processing path and functions are defined by the specific Request Parameter Buffer indicated by the user program's CALL command. The contents of the Request Parameter Buffer fields are identified in Table 1 and have the function or meaning as defined in Table 2 below. Table 1 above specifies the byte position within the Request Parameter Buffer fields and defines the meaning ascribed thereto. The request types, as shown in Table 2, are arbitrary codings with the meanings as defined for each of the request types shown. The recovery codes and the return codes also are arbitrary and are defined as shown. Other indicators and pointers are as defined in Table 2. The sender ID and receiver ID, bytes 17 - 24 of the RPB and 25 - 32 of the RPB as shown in Table 1, must be between one and eight characters in length in this embodiment. These ID's consist of alphanumeric characters or special characters chosen arbitrarily by the user. For operation of the programs that will be described herein, if a given ID is not eight characters in length it is left justified and padded with blank characters. For all types of requests by any user, control of program execution is returned to the user's requesting program following execution of the CALL command. For request type 1, the parameters required are the RPB length and type and the return code can be any of 10, 24, or 28. For request type 2, the required parameters are the RPB length, type, work address and receiver ID, and the return code can be any of 14, 15, 24, 26, or 28. For requests of type 4, the required buffer parameters are length, type, recovery option, work address, address space control block address, buffer queue limit, task control block address, the receiver ID, and the authorization indicator. The buffer queue limit is used to specify the maximum number of outstanding data buffers that will be permitted for a given receiver's buffer queue. If this limit is exceeded, the sender's data buffer of information will not be accepted by the communication facility program and the return code of 35 will be returned The return codes can be 0, 16, 23, 24, 28, 32, 35, 36, or 40 for this type of request When the request is completed successfully, the ECB address will contain the address for the ECB for the receiver program. This event control block is posted for execution when the data buffer of information arrives. The user program desiring to send the buffer must be APF authorized in order to use this type of request. For request type 9, the required parameters are: length (RPB-LEN), TYPE, recovery option (RECOPT), work address (WORK-ADR), Buffer Queue Limit (BUFFQ-L), ASCB-ADR, and RECEIVER-ID. The BUFFQ-L is used to specify the maximum number of outstanding data buffers of data that can be accepted for a receiver while it is not active. If this limit is exceeded, the sender's buffer of data will not be accepted and the return code will be 35. Return codes can be any of 0, 15, 23, 24, 25, 26, 28, 35, 36, or 40. A sender program can still send data buffers to an inactive receiver program, so long as the receiver's buffer queue as defined is not full. However, the sending program will receive a return code of 4 to indicate that the receiver program is currently not active. User programs should be APF authorized in order to use this request. For request type 12 the required parameters are: RPB-LEN, TYPE, RECOPT, WORK-ADR, SENDER-ID, BUFF-LEN and BUFF-ADR. The return codes can be any of 0, 4, 23, 24, 26, 28, 32, 34, 35, 36, or 40. A user program can use this request type to send a copy of an alert buffer data to a network management program for processing. For request type 14, the required RPB contents are: RPB-LEN, TYPE, RECOPT, WORK-ADR, SENDER-ID, RECEIVER-ID, BUFF-LEN, and BUFF-ADR. Return codes can be 0, 4, 23, 24, 26, 28, 32, 35, 36, or 40. As before, a sending program can still send data buffers of information to an inactive receiver program, but a return code indicating inactivity of the program will be sent back to the requestor. For the request type 22, the required RPB contents are: RPB-LEN, TYPE, RECOPT, WORK-ADR, ASCB-ADR, RECEIVER-ID, BUFF-LEN, and BUFF-ADR. The return codes can be 0, 23, 24, 25, 26, 28, 30, 31, 36, or 40. The buffer address should be the address of a buffer area within the receiver program address space where an incoming data buffer may be copied. If this request is successful, the sender ID field will contain the identification of the sender program and the buffer length will contain the length of the incoming data buffer. If the specified buffer length is not large enough to hold the incoming data for the intended receiver, the return code will be 31 and the length of the incoming data buffer will be placed in the buffer length field. In this case the receiving program should obtain another buffer large enough to hold the incoming data buffer and try the request again. Returning to Figure 1, the communication facility program may be seen to actually be constituted by all of the subroutines including programs A through G as depicted in Figure 1. Each of these programs resides within specified areas of memory within the same processor, as do the sender program and the receiver program. The individual program portions A through G will now be described with reference to Figures 2 - 8 where the detailed flow chart for each subroutine is illustrated. Turning to Figure 2, the detailed flow chart for Program A, the first portion of the communication facility program is shown. The operation of Program A is self explanatory beginning at the top of Figure 2 where Program A receives the RPB from a user, sender or receiver program. It may be seen that Program A saves user's program registers if desired, checks to see whether the remainder of the communication facility program and memory space is available, checks on whether the request presented is a facilities request or executes the user's request by utilizing the processing module Program B as shown. It also returns control to the user program as its final step as shown. Figure 3 illustrates the detailed processing flow of Program B beginning from the top where it receives its initiation from Program A. Figure 3 has various entry and exit points marked with encircled A, B, X as shown. Program B checks as to whether the user's request type as indicated in its RPB is valid, whether an initiation or termination of a receiver program is requested, and executes the appropriate action of either defining or terminating a receiver as in existence, checks to see whether the request is to retrieve a buffer of information or to send a buffer of information or to send an alert or to initiate or terminate as a receiver and executes the dequeueing routine D, or the receiver initialization/terminate routine E, or the queueing portion Program C as indicated. The queueing program is entered as shown in Figure 4 for program module C by initiation from Program B. This routine handles loading of receiver buffer queue within memory space of the communication facility program. The dequeueing program D is shown in Figure 5. Dequeueing Program D receives its input from Program B and operates as illustrated. No description is needed as the Figure is self-explanatory. Initiation or termination of a receiver is handled by the Program module E which receives its input from Program B as shown in Figure 6. It handles definition or termination of a given user program as a defined receiver to the communication facility program. Figure 7 illustrates the flow for processing of task or address space termination for Program F as shown in Figure 1. It is executed by an end of task or end of address space function from the processor and has the function of setting the defined receiver to not active and returning control to the caller program. Figure 8 illustrates the subroutine Program G from Figure 1 which is initiated by an operator requiring an end of the program to program information transfer process. As will be appreciated from the foregoing discussion, the program to program communication facility program does not require sender programs to be predefined and does not require set up or maintenance of a "session" in order for communication to occur. Once an intended receiver program has been defined to the communication facility by defining itself, any number of sender programs can start to communicate or send data to the receiver program. A receiver program is allowed to specify to the communication facility whether intended sender programs must be APF authorized in order for communications to be sent to it or not. When sender programs wish to communicate or send data to a receiver, the intermediate communication facility program copies the sender's data into a receiver's buffer queue within the communication facility program's address space, notifies the receiver that it has incoming data, and returns control to the sending program. A sender program doesn't have to wait for the receiver program to receive its data; it can start to send data to the same receiver again or to another receiver as soon as return of control is obtained. The receiver can specify a limit for the number of data buffers of information that the intermediate communication facility program should hold for it within that receiver's buffer queue. Similarly, a receiver can retrieve its data for processing whenever it is ready. Whenever the receiver issues a retrieve data request, the communication facility will copy the data, one data buffer for each request, into the receiver's address space and memory. Sender programs can still send data to a receiver program even when the program is not currently active. The intermediate communication facility program may accept and hold data for an intended receiver and return a status code to notify the sender program that the receiver is not currently active. The receiver program itself can notify the intermediate communication facility program that it is no longer active and it can specify a limit as to the number of data buffers of information that the communication facility program should accept and hold for it while it is in the inactive state. The communication facility program detects whenever a receiver program terminates normally or abnormally and will set the appropriate status for the receiver to not active. From the foregoing, it will be appreciated that a high level, easy to use program to program communication apparatus and technique have been described that can be used in any type of computer system by programs which use any arbitrarily desired high level programming language that can support standard program call operations. The call operation calls upon the intermediate program to program communication facility program itself entailing modules A-G as illustrated and described in detail and supports asynchronous, full duplex and non "session" oriented communication between user and receiver programs or machines as will be readily appreciated. In view of the foregoing description and indication of applications for the preferred embodiment of the invention, what is set forth in the claims which follow is intended by way of description and not of limitation.

Claims: Method of exchanging data between a sender program and a receiver program in a data processing system having an addressable memory, a processor, and a plurality of resident executable processor programs, storing a communication facility program in said memory; characterized by the steps of: calling said communication facility program from said receiver program, said receiver program identifying itself as a receiver to said communication facility program; calling said communication facility program from a sender program in said data processing system and delivering data to be communicated to said receiver program to said communication facility program; and requesting by said receiver program, said communication facility program to deliver any data intended for it. The method according to Claim 1 further comprising the step of copying at said communication facility program said sender program data into address space of said communication facility program allocated for data destined for receiver programs. The method according to Claim 2, further comprising the step of notifying by said communication facility program to said receiver program that data awaits said receiver program in said communication facility program address space allocated to said receiver program. The method according to Claim 3, further comprising the steps of accessing by said receiver program the address base of said communication facility program and retrieving therefrom data by copying said data from said communication facility program address space allocated to said receiver program. The method according to any one of Claims 1, 2 or 3, wherein said calling of said communication facility program by a sender or a receiver program includes a call command, the name of the communication facility program being called and a communication parameter specification having fields of information defining the length of the specification and the type of request being presented. The method according to Claim 5, wherein said specification further contains fields of data for the work address of the storage area required for the communication facility program and an identification of the receiver program which is destined to receive or which is requesting communication.

Inventors: RHODES MURDEN CECIL, WANG JEN SHIH, RHODES, MURDEN CECIL, WANG, JEN SHIH
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1989
Main classification: G06F9
IPC codes: G06F9