Back to Mobile View

Skip to Content

Dear Aunt TUAW: What are those lockfiles?

Dear Aunt TUAW,

With Lion, I'm seeing a lot of plist.lockfile in my Preferences folder. I'm assuming the "lockfile" business has to do with the new autosave stuff in Lion, but why would that apply to a preference file? Is this a bug or a feature?

Your loving nephew,

Darren

Dear Darren,

Feature.

Historically, lock files have restricted file access to one application at a time. Auntie has no reason to think that Lion's use of this concept differs. A lock file prevents a second edit from being applied concurrently, preserving information integrity.

Access control is especially important when competing processes might want to update an application's defaults at once.

Auntie went ahead and used opensnoop to watch what happened as she updated a few preferences. Sure enough, the lock file seemed to be set on application launch and reset on quit

% sudo opensnoop -f ~/Library/Preferences/com.apple.TextEdit.plist
UID PID COMM FD PATH
501 23363 mdworker 6 /Users/ericasadun/Library/Preferences/com.apple.TextEdit.plist
501 23363 mdworker 7 /Users/ericasadun/Library/Preferences/com.apple.TextEdit.plist

What surprised Auntie was how if she didn't identify a specific preference to watch, that all the preferences lockfiles were refreshed whenever a new lock was applied (Try it yourself, with sudo opensnoop with no arguments).

It was also fun to see how TextEdit updated its autosave information, its saved state, its shared file property list and more. Opensnoop is curiousity crack.

Hope this helps! Love & snuggles,

Auntie T.



Categories

OS X

Dear Aunt TUAW, With Lion, I'm seeing a lot of plist.lockfile in my Preferences folder. I'm assuming the "lockfile" business has to do...
 

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

1 Comment

Filter by:
eaglebtc00

I learn something every day reading this site. Thanks for mentioning opensnoop; I had no idea it was there!

August 16 2011 at 12:30 PM Report abuse rate up rate down Reply
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.