FORTRAN Reference Manual
Interprocess Communication
FORTRAN Reference Manual—528615-001
14-14
Message Queuing
The server opens a disk file of two-word records (the first word is the key; the second,
the associated data) and reads sequentially from it. If a requester has expressed
interest in the current record, the server sends it to that requester. Since the order in
which requests arrive is unpredictable, the server must save requests for records that
have not yet been read, until those records become available.
The server, after initialization, repeatedly reads from its data file. For each record, it
determines if a request for that record has been received already. If one has, the
server updates its list of pending requests and sends that record to the appropriate
requester.
If not, it must read requests until one for the current record arrives; it stores other
requests in its list of pending requests for future use. When the data file is exhausted,
the server returns an end of file for each stored request, and continues to return end of
file to all new requests. As each requester receives end of file, it closes the server and
terminates with a message to the home terminal. When the last requester has closed
the server, the server also terminates.
Assuming that the object program for the server is named $DIST, that there are two
requesters, $R1 and $R2, and that requesters read the following records,
a sample execution of this requester/server application might appear on the home
terminal screen as follows:
VST1409.vsd
1 1
2 2 2 3 7 4 6 5 5 6 4 7 3 8 2 9 1 10 3 11 4 12
0 1 2 3 4 5 6 7 8 9 10 11
Record Numbers
Twelve Two-Word Records










