Closed songlin-zheng closed 3 years ago
If you write open() before fork(), as indicated in the question, both processes will append to the end of th file, not overwrite.
I updated the answer in https://github.com/xxyzz/ostep-hw/commit/8fbf5e185da90cdd0c814074885a6eb171d59cb2. It depends on the scheduler, maybe they will write sequentially in most cases but not all the time.
If you write open() before fork(), as indicated in the question, both processes will append to the end of th file, not overwrite.