On Thu, 2006-01-19 at 12:30, [EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote on 01/19/2006 12:30:47 
> PM:
> 
> > 3) Atomically rename database.db.new to database.db
> 
> Can you enlightne me on what "Atomically rename" means?  How is that 
> different than just a mv command.  I can understand that a process that 
> opened the file under the old name is still going to point to the file 
> based on its location on disk, not by name.  I'm just picturing mushroom 
> clouds and guys in lead hazmat suits trying to do an atomic rename. :)

The non-atomic version boils down to 
  unlink(newname)  - if newname filename already exists
  link(oldname, newname) - now both exist
  unlink(oldname)
Other processes may get timeslices that see the filesystem
in any of those states, including the one where the newname
doesn't exist at all.  I think mv will attempt a rename
and only do it the hard way if the rename fails, which should
only happen if the old/new files are on different filesystems
in which case the hard way involves a copy.

-- 
  Les Mikesell
   [EMAIL PROTECTED]


_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to