[Info-vax] QIO Writes to a mailbox

Albrecht Schlosser vms-news at go4more.de
Wed Nov 9 06:52:30 EST 2011


On 08.11.2011 22:36, VAXman- @SendSpamHere.ORG wrote:
> In article<j9c6ug$r1s$1 at news.albasani.net>, Jan-Erik Soderholm<jan-erik.soderholm at telia.com>  writes:
...
>> One efficient way to do it is to check the previous IO (say, by
>> checking the IOSB) right *before* you will do the *next* $QIO.
>> In that way, you can do any other processing you like in your
>> app while the I/O subsystem completes the IO asyncronicaly.
>>
>> Always waiting right *after* the $QIO is inefficent and you could
>> anyway use $QIOW and let the system take care of the "waiting".
>
> Even when using $QIO and an AST, one needs to check the IOSB.  Like I said,
> specify the IOSB, check it and assume nothing!

Yep, that's true, of course, but may not be sufficient in
Steve(the OP)'s case. He did not write anything about how
often mailbox writes are generated (maybe asynchronously)
in the writer program.

If we assume that he reuses buffers (as well as the IOSB),
then it might be possible to overwrite one message with the
next message, so that two consecutive QIO's will send the
same message to the mailbox. I know, this has already been
said, but it should be considered as a possible cause of
errors too. Thus, the reader process might read one message
twice, and - depending on the processing in the reader
process - may not realize the duplicate, and also miss the
overwritten message. This *could* explain what Steve is
seeing, even if all I/O's were working correctly (QIO and
IOSB success).

Jan-Erik's idea to check the previous IOSB value just
before the next I/O might help, if the code also makes
sure that the I/O buffers are written *after* the check.

Of course, it would be better not to overwrite I/O buffers
and to use different IOSB's as long as it is possible to
do asynchronous writes to the mailbox in the first place.

I'd check this possible overwriting as well as the IOSB
return value, especially if all messages are of the same
sizes (so that overwriting the buffer contents wouldn't
be so obvious).

Albrecht



More information about the Info-vax mailing list