Friday, November 09, 2012

The Myth of Multitasking

As an engineering summer student, I had some fantastic summer jobs at Glenayre electronics in Vancouver, where 8-bit microprocessors were already changing how telecommunications systems worked. Part of my job was about learning to use, and debug, what were called multitasking operating systems. They had names like MPM and Kadak.  And there I found a secret.

There ain't no such thing as multitasking. All these system do is quickly jump from doing one small part of a task to to another small task, and because these things are so fast compared to we carbon-based life forms, if you squint your eyes a bit you can imagine they are doing those thing at the same time.


Why did developers of so-called multitasking operating systems do it this way? Why didn't they let the computer finish one thing before it started another, like the annoying construction foreman in Tonka Construction? I think it is because since people are so slow compared to computers, that the CPU might as well try to do something useful rather than wait for billions of nanoseconds while a human's fingers hover over a keyboard awaiting inspiration.

Making a computer change from one task to another is surprisingly easy. It's called a "context switch", and for a computer it is a simple, quick task. Most everything the actual CPU does is stored around it, in memory (RAM), or on the hard disk, or flash memory, things that don't change if you leave them alone, like the way you've spread papers around on your desk. The actual information a CPU has to "swap out" to change context is a few hundred bytes. That's because computers are not deep thinkers. They don't pore over ideas, and hold several in their little imaginations, and consider the technical or artistic merit of one over the other. They just move memory around, and compare, add and subtract numbers.

The illusion of multitasking only works if the amount of time you can spend on a task is far greater than the time it takes you to switch from one task to another. If you give a computer so many tasks that it spends all its time switching from one task to another instead of accomplishing anything, it might seem very busy, but it is accomplishing nothing.

Which leads to this obvious but important statement. You are not a computer. You are not as fast as a computer, and for you, a context switch takes anywhere from several seconds to several minutes, and requires millions of neurons.

If you think you are a multitasking machine, guess again. All you can do is switch your attention from one thing to another. Whichever thing you are paying attention to is swapped in, and nothing else is going to get that kind of attention.

Be human. Focus.