in Links

Uninterruptible programming

Being a developer, or doing anything creative, usually requires being “in the zone”. Being interrupted usually makes one drop right out of that sweet zone of productivity, and it usually takes a lot of time getting back.

uninterruptible programming is an interesting post dealing with how to handle this situation by constantly keeping the current state, and is exemplified by a filesystem journal.

The way it works is simple. When you want to do a disk operation, first, you write down in a special place (called a journal) what you are going to do, at a high level. “I’m going to delete this directory and all its files.” Then, you go through the steps of actually doing that. Finally, you record in your journal that’s what you did.

Now when power is interrupted during a disk operation you simply look at the journal and you can complete any operations that were in-flight at the time of the interruption. For example if the journal says “Delete X folder” and you see it still exists, now you delete it. It’s eventually consistent, even in the face of power interruptions, assuming that the intent hits the journal. And since journaling a high-level operation is a lot faster than actually doing it, chances are you’ll die doing the operation, not doing the journal.

Sounds simple enough, but instead of relying on a physical notebook, I would use Evernote, since I already use that for everything remotely considered reference material.