Limitations of Overlapped I/O in Windows 95Last reviewed: September 25, 1995Article ID: Q125717 |
The information in this article applies to:
SUMMARYWindows 95 does not support overlapped operations on files, disk, pipes, or mailslots, but does support overlapped operations on serial and parallel communication ports. Non-overlapped file write operations are similar to overlapped file writes, because Windows 95 uses a lazy-write disk cache. Overlapped I/O can be implemented in a Win32-based application by creating multiple threads to handle I/O.
MORE INFORMATIONAsynchronous I/O on files, disk, pipes and mailslots is not implemented in Windows 95. If a Win32-based application running on Windows 95 attempts to perform asynchronous file I/O (such as ReadFile() with any value other than NULL in the lpOverlapped field) on any of these objects, the ReadFile() or WriteFile fails and GetLastError() returns ERROR_INVALID_PARAMETER (87). Overlapped I/O to serial and parallel communication ports is fully supported in Windows 95. To implement overlapped I/O, call CreateFile() with the FILE_FLAG_OVERLAPPED flag set in the flags attribute. Overlapped I/O on disk and files was not implemented in Windows 95, because the added performance benefits (which would only affect a certain class of I/O-intensive applications) were not judged to be worth the extra cost. The system uses a lazy-write disk cache algorithm which automatically provides many of the benefits of overlapped writes. When a process writes data to a file, the data is written to the cache and then the write immediately returns to the calling process. Then, at some later time, the cache manager writes the data to disk. This is similar to behavior that is achieved with overlapped I/O. In the case of disk/file reads, many applications that need to read data do so because it is needed for further processing. Some applications benefit greatly by prefetching data from files while doing other work. Although Windows 95 does not implement overlapped I/O, it is possible for Win32-based applications on Windows 95 to create additional threads for implementing an effect similar to overlapped file I/O. One way to implement this effect is to communicate with an I/O thread using a request packet mechanism. The thread can queue request packets from other threads and service them as it is able, signalling the other threads on the completion of each request with an event. Even though the application may be "waiting" on some I/O activity, it can still be responsive to the user since the main, or user interface, thread is not blocking on I/O requests. However, the use of multiple threads will increase the amount of time spent in the kernel, which leads to inefficiencies, as compared with an operating system that supports overlapped I/O. NOTE: Windows NT has a lazy-write disk cache as well. It has been found that a write-back cache is not as good as overlapped I/O, particularly when the data is much larger than the file cache or noncached I/O. One of the biggest benefits of overlapped I/O is that it allows you to quickly get lots of outstanding I/O posted to the disk controller, thereby keeping the disks busy with tagged command queueing in the controller. Using multiple threads is a reasonable substitute, but I/O may be serialized in the filesystem.
|
Additional reference words: 4.00 95 asynchronous overlapped
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |