Alex Rivera | Logout

Multiple threads reading from the same file

Asked 2009-05-05T05:30:46.523
18

My platform is windows vista 32, with visual c++ express 2008 .

for example:

if i have a file contains 4000 bytes, can i have 4 threads read from the file at same time? and each thread access a different section of the file.

thread 1 read 0-999, thread 2 read 1000 - 2999, etc.

please give a example in C language.

Edit
Report

1 Answer

2

I don't see any real advantage to doing this.
You may have multiple threads reading from the device but your bottleneck will not be CPU but rather disk IO speed.

If you are not careful you may even slow the processes down (but you will need to measure it to know for certain).

answered 2009-05-05T07:03:25.897

Your Answer