| puetti (1) | |||
|
Hi everyone, my question concerns the parallel I/O safeness of C file streams. In a simple MPI program I do something like this in parallel:
The question is simple: is this in general safe? I mean, is it possible that the different processes' file pointers could somehow interfere with each other? Or does this also depend on the underlying file system? I'd appreciate if someone could elaborate a little on the principles of I/O stream etc. And going one step further: What about using that code for file *writing* instead of only reading? Thanks in advance for your help! Andreas | |||
|
|
|||
| kbw (5375) | |
| FILE* uses buffered I/O. So there's always an issue when writing. However, multiple processes can read without locking. On some OS' (like Windows) the share-read option needs to be set. | |
|
|
|