Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 9
Using File-System Buffering
By issuing SETMODE function 72, you cause the operating system to use an
intermediate file-system buffer in the process file segment (PFS):
LITERAL USE^PFS = 72,
ON = 1;
.
.
CALL SETMODE(FILE^NUM,
USE^PFS,
ON);
Consider two concurrent read operations that use the same buffer without using file-
system buffering:
1. The first read operation starts and reads data into the application buffer.
2. The second read operation starts and also reads data into the application buffer.
3. The AWAITIO[X] procedure now completes the first read operation. However,
instead of returning the record read by the first operation, the buffer contains the
record read by the second operation.
The same two read operations making use of file-system buffering in the PFS execute
as follows:
1. The first read operation starts and reads data into a location in the PFS.
2. The second read operation starts and reads data into a different location in the
PFS.
3. The AWAITIO[X] procedure completes the first read, transferring data from the
location in the PFS assigned to the first read operation. The returned data
therefore corresponds to the first read operation.
Note. The most effective way to prevent concurrent I/O operations from destroying the
contents of each other’s buffers is by using different buffer areas. That way there is no need
for system buffering, and your program can take advantage of the efficiency of transferring
data directly from the I/O buffers to the application buffers.