Disk I/O speed through ReadFile

Hi,

I've been writing a program which runs through a hard disk and identifies items of data of interest, in a similar way to an anti virus scanner.
This has been done using the ReadFile windows API functions
(http://msdn.microsoft.com/en-us/library/aa365467%28VS.85%29.aspx)
I have been reading 32kb chunks of a disk and am getting a speed of about 500-800MB per min. I'm looking to try and increase the speed.
Has anyone done anything similar?
Also, is there a way to set a "timeout" function so that if the api doesnt return data within a given timescale the program doesnt wait and does something else?

Thanks for any help in advance

Use overlapped I/O.
As a solution to which problem?
Your I/O throughput problem. It allows the read request to run in parallel with your code that processes the read data. It makes best use of DMA.
Have had a look at the overlapped I/O using readfile and it appears I have to run a loop after the read request until it returns that it has read, if this is the case wont it be the same speed? I'm sorry if my understaning of overlapped read i/o is wrong here.
On that note could that be a solution to my second problem, i.e. that if it doesnt return a done signal after so long I could use that as a timeout?
Last edited on
You don't have to sit waiting around in the loop, you can go off and process the data, and then when you're done, check for completion.
So I take it you mean a process similar to the following:
Read first block
start reading second block
process first block
at end of processing check second block ready
start read of next block

in a loop?
(Just a thought containing a question):

May it be more efficient to use I/O-Completion Ports in this scenario?
minime Yes.

Incubbus I/O-Completion Ports do the same thing as overlapped I/O. They are both ways of doing asynchronous I/O.
Last edited on
KBW thanks for the help, should be able to sort that now :)
@kbw: i thought tht I/O-Completion ports are the most efficient way of doing Async I/O (possibly the most complicated way)...
They probably are. I don't know.
Topic archived. No new replies allowed.