Is it possible to read from a file at different offsets in one system call (with out seeks inbetween), like windows overlapped IO?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question doesn’t make sense. Windows overlapped I/O is simply an asynchronous method for reading (in this case) the file. It allows your thread to do something else while waiting for the I/O to complete.
You cannot use it to read multiple sections of a file without intervening seeks, in a single call.
You can use it to have concurrent accesses going on at the same time but you have to specify each time what segment of the file you want (in other words, implicit seeking) but you have to do this as multiple calls, one per segment.
If you want asynchronous I/O under Linux, DeveloperWorks has an interesting article on the
aiostuff here, available from Kernel version 2.6 onwards.Keep in mind that asynchronous I/O (even under Windows) is probably not going to benefit you that much for fast “devices” like a local hard disk. It’s probably not worth the extra effort in coding for that use case. Where it comes into its own is with relatively slow devices like network storage or socket communication, where you may be able to get quite a bit of work done before the I/O completes.