Hacker News new | past | comments | ask | show | jobs | submit login

On HFS+ on OS X, most file writing is done atomically, by writing to a temp file and atomically switching the (conceptual) data pointer of the target file, aka FSExchangeObjects. It's common to end up with some of these temp files in ~/Library/Preferences, ending in .plist.asdfx, when the process was interrupted (so the original remains untouched).

This can be done for directories too - make a new one, write changed files and hard link unchanged ones, then FSExchangeObjects. Obviously this scales linearly with the number of files in the directory, so it's not perfect. I'm not sure if / how any of this is used for system updates, though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: