When a child is forked then it inherits parent's file descriptors, if child closes the file descriptor what will happen ? If child starts writing what shall happen to the file at the parent's end ? Who manages these inconsistencies , kernel or user ?
when a process calls the
close function to close a particular open file through file descriptor. In the file table of the process, the reference count is decremented by one.
But since parent and child are both holding the same file, the reference count is 2 and after close it reduces to 1. Since it is not zero the process still continue to use file without any problem.
See Terrence Chan UNIX system programming,(Unix kernel support for Files).