in reply to Locking database

One locks a file so that no more than one process will be attempting to alter that file at the same time. Fundamentally, it has nothing to do with users, but processes (think of two people trying to write to the same line on the same piece of paper at the same time ... that's like two processes contending to write to the same file at the same time).

So, if you have a script, say, foo.cgi, that updates a database (say, based on user input), you want only one INSTANCE of foo.cgi to be writing to the DB file at any one time, in order to make sure that the DB doesn't get messed up.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor