I am new to Unix. I have two processes containing descriptors (file descriptors) in one file on disk.
Let the processes be A, B and the sample.txt file say
Process A is the producer (writes data to the disk file), and process B is the consumer (reads from the disk file).
Process A reached the point at which it closed the file descriptor (descriptor) in the sample.txt disk file, deleted the file from the disk and opened a new file with the same name as “sample.txt” and began writing to the new file. Meanwhile, process B still has an old descriptor pointing to the old file that was deleted by process A.
Now, what happens when process B tries to read the file using the old descriptor and will it still be able to fully read the old sample.txt file to the end?
Unix guru, please shed some light on this. Any pointers to Unix kernel documents are much appreciated.
source
share