FAM

FAM (File Alteration Monitor) is a daemon which can be used to get notification when a file or directory changes. It is developed by SGI and often used by applications such as file managers, e.g. nautilus uses it when available.

FAM is made out of two parts, famd the actual daemon application and a libfam which client applications can use to communicate with FAM.

famd can be run as an xinetd service or just always started a boot.

background info
FAM solves a common problem encountered in writing applications which have to react when a file or directory changes (e.g. file managers,email arrival notification,etc.). The old method of doing this is by continuously polling the file/directory in a loop (usually with a little delay). As you would expect this is not an very efficient method, lots of applications could all be continuously polling files causing a lot of disk activity and sucking up CPU time. FAM solves this by having a common API (libfam) and a daemon. Applications can register which event (like a write,delete,create,execute) for a certain file/dir they want to be notified about. This means there will be only one polling loop and if multiple applications monitor the same file, there won't be a duplication of effort.

FAM also supports (instead of a polling loop) kernel based monitoring, which is an even more efficient method. For Linux this is called dnotify (standard in recent 2.4 and 2.6 kernels). A patch is needed for this at the moment, since the last official release doesn't include this support. But many distributions ship FAM with this patch already enabled by default.

External link

 * SGI FAM project page (oss.sgi.com)