A type of file locking. An advisory lock says the file should not be modified by anything other than the processes that have the lock. There are exclusive and shared locks.
In a village in middle of the swamps lived a little granny. Every time she went to the marketplace for her business, she put a broom leaning against her house's door. This way, the rest of the villagers knew she was not home, and knew not to come in uninvited.
Advisory locks are a bit like that broom there - they just tell "this file is locked, don't modify it until it's unlocked!", but if program that doesn't know anything about locking changes the file, it will get changed. If a cruel, heartless criminal from lands afar decides to rob the granny, he will be able to do that. The world is a cruel place.
This sort of locks are more flexible than mandatory locks, but using them requires some excercise.
In UNIX, advisory locking is done with
lockf() commands (the latter is the Real POSIX Way, apparently). Perl's
flock command always gives advisory locks only.
Contrast: mandatory lock. See also lock file.