Thursday, February 7, 2008

When 1 + 1 < 2

Today's hectic, frenetic world has carved out a Special Place for the almighty “multitasker” — the master of the modern world, armed with a Blackberry or Palm or iPhone or whatever other Smart Thing gets everyone hot and bothered about being “productive.”  This multitasker can send texts, perform Google searches, take kids to soccer practice, and close face-to-face deals while making dinner reservations and dictating letters to a secretary...all at once!!!  Indeed, sometimes it seems as if society has been transformed in the multitasker’s image, stacking the odds for a successful and satisfactory life so that they heavily (and perhaps unfairly?) favor those among us who can divide the work that we do into 24-second shot clock sprints.

I’ve had my own personal encounters with this multitaskalomania.  A prior supervisor once advised me to structure my time in just such a multitasker mode, “in order to succeed.”  To manage the 7–10 really important things that my job entailed every day (supervisor’s emphasis, not mine), I was told to allocate roughly an hour on each task, no more and no less.  Need to do some reading and make some phone calls?  Give myself an hour to read, then stop and pick up the phone.  Stop talking after an hour — no matter what — then check in on some of the folks on my team.  Then eat, then work on that proposal, then work on that paper, then attend this meeting, then write some code — for just an hour! — then finally write more code, but of the recreational type, so that I can “keep on pushing the envelope.”

Indeed, said supervisor seemed to take this advice to heart as well — no hypocrisy here, at the very least.  Every day was a whirlwind of activity...a whirlwind that was so nearly literal that he earned the nickname “Tasmanian Devil.”  In order to succeed, I also had to become Taz-like — move forward, a little bit, on a bunch of things everyday, papers a-flying, arms a-flailing, task chair a-spinning.  Otherwise, I would fall behind, as irrevocably as a lost hour of sleep, outplayed and outlasted by those who were better suited to career survival.

If, upon reading this far, you find yourself doing the Tiger Woods elbow jab saying “Yes!  That’s the way to do it!” then good for you — you may well have that Darwinian edge which will ensure your descendants’ survival into the cockroach era.  But, if you’ve been reading this going, “Yes, that’s what I’ve been told to do before, but I never felt too comfortable with it and prefer to work on fewer things — preferably one — in a single day,” then you may have some computer scientist in you.

For, as computer scientists know — especially those who specialize in operating systems and concurrent programming — multitasking has a cost.  And, if we aren’t careful, we can easily end up spending more time juggling jobs than whipping up work.

Not surprisingly, the cost of human multitasking is most concrete when looking at computer multitasking.  Most modern computers have more work (processes) going on at once that they have brains (processors) — yes, even in this day and age of multicore processors.  Thus, they are a lot like us — they need to divide their time and “attention” among multiple tasks.

One of the primary tasks of a computer’s operating system is the scheduling of these tasks.  One such scheduling approach, called round robin, is used by systems that need to be “interactive” (in other words, systems that make sure their users don’t feel ignored).  Round robin scheduling is not unlike my aforementioned supervisor’s work style: do a little bit here, then stop.  Then a little bit there, then stop.  The more “little bits” you do, the better.

Every time an operating system makes a computer go from one task to another (round robin scheduling or otherwise), it undergoes a process called a context switch.  Transferring a computer’s attention from one program to another entails a certain amount of bookkeeping: taking note of where the computer left off in the previous program, keeping track of the values used by the previous program and the values that will be used by the next, etc.  The catch is, while the work done during a context switch is critical to proper operation, this work is outside the actual work that needs to be done — that is, the work being done by the programs running on a computer.  Because of this property, a context switch is viewed as overhead — something that takes up time and resources, but isn’t the actual “thing” that we want to do.

The big gotcha with context switches and round robin scheduling lies in the round robin quantum — that is, the amount of time to give each process before moving to the next one.  The quantum has to be small enough to make the overall computer feel like it’s doing a bunch of things at once — sort of in the same way that the individual frames of a movie fly by fast enough for our eye to perceive smooth movement.  But, as you switch tasks, you incur the overhead of a context switch, which, no matter how you cut it, will take some amount of time — and thus, if your quantum is small enough, you’ll end up spending more time doing context switches than you do with actual work!

So it is with daily life.  Like computers, we undergo a form of “context switch” when we shift from one task to another.  Ever feel light headed after trying to work on a project but getting interrupted frequently by a phone call?  That’s the toll of too many context switches.

Tom DeMarco and Tony Lister, the authors of Peopleware, use different terms for the same idea: when people are working on some task, they get into what DeMarco and Lister call flow.  Flow is a kind of “work continuum,” a “groove” of sorts, where thoughts are flowing, muscles are coordinating, and production moves along smoothly.  When flow is broken — either by phone calls, people stopping by your office, or changing to another task — then we need some time to get back “into” the flow of the original task.  This is analogous to a computer’s context switching — it’s overhead.  Something that takes time to accomplish, but isn’t part of what we actually want to accomplish.  Bottom line: the more you break the flow (rotate tasks every hour!  or even less if you can handle it!), the less work you will actually get done within the same amount of time.  Or, 1 + 1 turns out to be less than 2.  When you can, don’t juggle — take a task, get it done completely, and move on.  When you can’t avoid juggling, try to spend as much time on something before switching.  The time you spend now will come back to you in the long run.

No comments: