Thursday, August 23, 2007

On The Cost Of Context Switching

At work lately, there's been a fair bit of talk about how expensive it is whenever people context switch. For those who don't know - and I'm far from an expert on it myself - context switching occurs whenever you move from doing one thing to another. This can happen on a myriad of levels, often without you even consciously realizing it, and (I'm guessing) the cost is probably proportional to the average 'ramp-up' time involved in the new activity. For example, going from reading E-Mail # 1 to reading E-Mail # 2 is presumably an example of context switching, but the cost there could conceivably be very small, especially if both e-mails were on the same topic. Alternatively, you could go from reading a light-hearted joke sent to you by your dear old auntie to an in-depth description of some diabolical work problem that's got you near the end of your rope. In that case, it might take you longer to get into the right frame of mind to absorb and digest what's in the second message, after having such a good, relaxing time with the first.

A more significant example of context switching might involve bouncing back and forth between trying to actually track down that diabolical work issue and attempting to write a design document for some upcoming project. The type of thinking required for those two very different activities probably don't have much in common, and each is complex in its own way. Therefore that's a much more expensive context switch, meaning that more time is required in order to pull it off successfully. And were you to, for whatever reason, have to ping pong from one to the other every few minutes, for example, you'd quite likely make absolutely no progress at all, even after an hour or more. Hence the notion of there being a cost. Some time is lost, on each context switch, while your brain changes gears, as it were.

Anyway, what made me think of this were my own experiences with the AgileMan 2.0 track that I'm on. Today I realized that I've essentially moved from Tactical Mode to Strategic Mode in terms of what I'm spending most of my time on. During the first year of Agile at our company, I was working directly with some of the Feature Teams, as well as most of the Feature Leads and lots of other supporting staff. My time tended to be spent helping those folks either figure out how to "be Agile" or work their way through problems that were immediately in their way. That's pretty tactical.

Since coming back from vacation - and the Agile 2007 Conference - though, I've committed to working on some of the bigger, pervasive cultural problems that are causing, or at least contributing to, many of our tactical challenges. At the same time, though, I can't completely abandon all of the relationships and responsibilities I used to have, meaning that I'm finding that I'm having to switch between the two modes fairly frequently. And I think that's beginning to really wear me out (this shocking admission, coming after only 2 weeks back at work!)

On the other hand, I'm enjoying myself more than I was before I went on vacation, so I guess it's a fair trade-off. But there are certainly some major, widespread challenges looming in front of me. And probably none of them will be completely fixed anytime soon. Making me think that strategic stuff sucks... in a way.

2 comments:

Anonymous said...

...sucks but has such an amazing impact on the tactical. So no pressure, but when the strategy is messed up the tactical doesn't function as well as it could (duh). So good luck with this and watch out for the tactical sucking up all of your time. It's very seductive to solve something and let the 'airy/fairy' strategic thinking slide.

cjguerra said...

I think there are at least two levels of context switch. The first being "what I'm doing right this instant" and "my current goal". I find myself able to jump around the micro-level pretty well. Walk up to me and ask a random question (How do I setup a build environment? What is the Light Weight Triggers API? Can you think of a smaller way to represent this information?) and I can pause what I'm doing and answer and go back fairly easily. If the question requires a certain level of recall, then it is difficult to jump back, but that happens rarely.

The second level is more macroscopic and is something like "design and implement the ETV storage layer using LWT API". It's the kind of large task that your mind will work on subconsciously for days at a time. Context switches at this level are very costly. Such a switch would include a move between feature teams, or beginning work on an item not directly related to the what you are leaving.

The second one is harder to switch to/from because of the many implicit subtasks that go along with it. There is so much to keep track of. I believe that there are two things that can help:

1) The more you do those switches, the better you are at recalling the different vital pieces of info.

2) I believe you can structure your work on each task in such a way as to make the switch easier. Think of it as "modular programming" for other tasks. Work in small increments that don't require much context. Work in discrete chunks, taking breaks, getting up etc when a chunk is done.

Anyway, that's my late-night ramblings for today.