Re: Good point of Linux over Windows (TM) NT (Async I/O & NT)

W. Reilly Cooley (wcooley@navi.net)
Wed, 22 Jan 1997 22:40:55 -0800 (PST)


Just to clarify, perhaps a bit vaguely, about NT's handling of
asynchronous I/O:

"... all the I/O operations in Windows NT are, at the system level,
asynchronous. Normally the Win32 subsystem simulates synchronous
operations by holding a client program in suspention until its command
finishes, but the subsystem also permits a program to request
asynchronous operation. You can initiate an I/O operation without
waiting for the result." p. 740

"The system will not call the completion routine while the I/O thread is
running, only when it is waiting. To receive callback notification, a
thread must enter an alterable wait state by calling one of the three
functions that make a thread block but allow I/O results to interrupt the
wait...

The need to enter an alertable wait state in order for the system to call
your completion routine feels to us like a limitation. Both the event
and the callback versions of asunchronous I/O are really semi-synchronous
since both require that the program eventually enter a wait state
synchronously in order to receive the I/O result.." p. 744

"The semi-synchronous need to wait for results has the advantage of
avoiding problems that can arise, especially on RISC machines, if the
completion routine is allowed to interrupt anywhere between any machine
instructions in your program.

It should be apparent that you can achieve the effect of asynchronous I/O
by creating a new thread to execute each I/O command. One advantage of
creating threads is that you can interrupt them, either by a prearranged
signal or with `TerminateThread'. There is no way to cancel an
asynchronous ReadFile or WriteFile command. But asynchronous commands
transfer the burden of creating threads from you to the system." p. 745

Hamer, Eric and Myers, Brian. "Mastering Windows NT Programming".
SYBEX, 1993.

Another note about NT being "warmed over VMS": if I am not mistaken, MS
had some previous direction in its previous work with OS/2.

W. Reilly Cooley
----------------------------------------------------------------
The Naked Ape Consulting
1509 NE 10th Ave., #104 Portland, OR 979232
503 287-2165
wcooley@navi.net
http://www.navi.net/~wcooley

A horse walks into a bar and the bartender says, "Hey, why the long
face?"