Availability Guide for Application Design

Availability Through Process-Pairs and Monitors
Availability Guide for Application Design525637-004
7-19
Nowait I/O and Multiple Requests to the Same File
The following paragraphs describe some of the complexities of performing nowait I/O
operations in process pairs. For details on nowait I/O, refer to the Guardian
Programmer’s Guide.
Nowait I/O and Multiple Requests to the Same File
Nowait I/O for accessing processes further complicates the tasks of checkpointing or
updating state information and takeover, because it is possible for requests to finish in
an order different from the order in which they were issued.
Process opens can have a nowait depth greater than one. When this is done, you can
have concurrent nowait requests against the same file. For process pairs, you need to
specifically save the synchronization identifier of each request when it is issued and,
following takeover, explicitly reset the synchronization identifier using the saved value.
The reason for this is explained in the following example.
Consider the case where three nowait requests are sent to another process:
1. Request 1 with synchronization identifier 0
2. Request 2 with synchronization identifier 1
3. Request 3 with synchronization identifier 2
If the primary process had been checkpointing file-synchronization information all
along, and the backup process simply reissued the request on takeover, these nowait
requests would be reissued with the incorrect synchronization identifiers of 3, 4, and 5.
By saving the synchronization identifier values for each request and then restoring
these values on takeover before reissuing the requests, the backup process continues
with the correct synchronization identifiers for each request.
An important rule about concurrent nowait I/O is that it must only be used when the
order of the requests is not important. Retries are issued on the basis of the completion
status of the request—if it finishes with a path error, the request is resent.
In the preceding example, it would be possible for the first and third requests to
succeed, but for the second to fail and be retried. All three requests would eventually
succeed, but the first and third requests would be performed before the second one.
This is why the synchronization information must be explicitly tracked for each request,
and it is also why process synchronization identifiers are implemented differently from
disk synchronization identifiers. Disk files are limited to a nowait depth of one so that
operations will always finish in the order in which they are issued.
Nowait I/O and Multithreaded Design
Multithreaded processes are another example of a type of application that is made
more complex by designing it to run as a process pair. Multithreaded requesters must
use nowait I/O to solicit input from terminals; otherwise, all threads would have to
suspend waiting for any one thread to receive a response. The I/O state of all threads
must therefore be checkpointed or updated to enable the backup process to takeover.