I have a small application that processes a large number of (relatively small) files. It is executed sequentially: it downloads data from a file, performs operations on it, and proceeds to the next file. I noticed that during operation, the CPU usage is not 100%, and I think this is due to the fact that the I / O time on the hard disk is.
Thus, the idea would be to load the following data into memory in parallel with the processing of the current data using a separate stream (the data to be examined will be just an int sequence stored in a vector). This seems like a very common problem, but it's hard for me to find a simple, simple C ++ example to do this! And now C ++ 0x is on its way, a simple demo code using the new stream feature, without an external library, will be very enjoyable.
In addition, although I know that this depends on many factors, is it possible to get a reasonable assumption about the advantages (or failures) of such an approach with respect to the size of the data file to upload, for example? I think that with large files, disk I / O is very rare, since the data is already buffered (using fstream (?))
Olivie
source
share