In operating system, a file control block could be represented as inode or vnode.There are two integers refcount and opencount in this structure.
What’s the difference between them?
In operating system, a file control block could be represented as inode or vnode.There
Share
The reference count refers to number of hard-link references to the inode, while the open count refers to the number of programs which have opened the inode.
These counts are important particularly when deleting. If we allow the OS to return the space previously occupied by the inode to the free list as soon as it is deleted, hard links will become orphaned. Similarly we don’t want to delete something that is currently in use in another program.
See http://cgi.cse.unsw.edu.au/~cs3231/12s1/tutorials/week07-sol.php?print=1 for more information.