What exactly is the mechanism by which the linux knows that a file has been closed ? I know commands such as INOTIFY would trigger IN_CLOSE_WRITE event when a file is closed. But how does it work ? What triggers close of a file ?
Similarly how does OS know that a file has been opened and where does it register that fact?