Dirich
June 25th, 2013, 11:46 AM
Hello,
when I learned about threads either I thought (or I read, I can't remember which) that they would be good to handle I/O. I mean, if I have to write stuff in 3 files and I want to keep processing, I can make 4 threads, 1 will be doing the processing work, and the other 3 will be dedicated to write in one file each. In this way I can keep computing all the time while the "writer threads" wait for I/O operations to carry out.
Recently though, someone told me that he wrote a program that had a lot of I/O operations, and for such reason threads were so bad he actually had to disable them.
I am curious, who is wrong?
Mind that his program uses MPI, so I guess he can use some processes to do the I/O while others carry out computations. So maybe, if the answer to the previous question is "depends", a better question could be:
Is it really better, performance wise (time and memory), to handle I/O via processes and MPI instead of threads?
when I learned about threads either I thought (or I read, I can't remember which) that they would be good to handle I/O. I mean, if I have to write stuff in 3 files and I want to keep processing, I can make 4 threads, 1 will be doing the processing work, and the other 3 will be dedicated to write in one file each. In this way I can keep computing all the time while the "writer threads" wait for I/O operations to carry out.
Recently though, someone told me that he wrote a program that had a lot of I/O operations, and for such reason threads were so bad he actually had to disable them.
I am curious, who is wrong?
Mind that his program uses MPI, so I guess he can use some processes to do the I/O while others carry out computations. So maybe, if the answer to the previous question is "depends", a better question could be:
Is it really better, performance wise (time and memory), to handle I/O via processes and MPI instead of threads?