Productivity and Context Switching

The way that computer scheduling works is that you have several tasks running at a time, in a queue for the processor. In multicore and multiple processor situations, you can think of it as being the same but with  multiple queues each with several tasks. So what happens is that the first task gets the attention of a cpu and its data is loaded into cpu cache and the cpu starts executing the instructions at lightning speed until one of three possible things happen:

  1. The cpu gets interrupted to do something urgent.
  2. The task interrupts itself by sending a call to a peripheral e.g. a request to read data from a disk.
  3. The task runs out of its allotted time.

The first of these situation is a regular event, because the cpu is responsible for the operating system and if something needs doing to manage the computer then that takes priority over any application. The second situation is also a regular event. Most programs do not spend much time on the processor before they need to call for something. There are programs that do. For example, you can calculate pi to 50,000 decimal places and that’s a cpu-only task. The third situation is how a task like calculating pi to 50,000 decimal places gets evicted from the cpu. It uses up its time.

When a task gets evicted from the cpu it’s called a “context switch”. The data held in cpu cache is unloaded and the program is saved in its current state so that when it gets back into action the cpu can continue from where it left off. New data is then loaded for another process and the program code for that process is loaded and the cpu begins to run it.

Now if you’re a chip expert, you’re probably thinking that the whole context change process in a modern chip is more complicated than that, and indeed it is, but that’s not what I’m interested in here. I’m interested in the fact that context switching is expensive in terms of computer time. When a context switch occurs the cpu doesn’t just point itself at another string of instructions and start to plough through them, it unloads one instruction stream and its associated data and loads up another one before it gets on with the work it is supposed to be doing. For that reason, operating system scheduling algorithms are based on trying to minimize context switching while still balancing the work done between various competing programs.

The Human Context Switch

As far as context switching is concerned there’s a direct parallel between the human being and the computer. People also becomes less productive if there is too much context switching. Context switches occur for three reasons:

  1. You get interrupted to do something urgent – like answer the telephone.
  2. The task you are engaged in has to be set aside while you wait on someone else to do something – or possibly you are forced to change roles. For example, you need to “stop for gas.”
  3. You run out of the allotted time – you have to “go to a meeting” or whatever.

If you focus in on how you use a computer, you seem the same thing going on you flit from one application to another often leaving things incomplete because of interruptions.

The Antidote to Your Context Switching

There are two things that can be done to improve the situation, whether we are thinking in terms of how you do your job or how you use a computer:

  • Minimize interruptions
  • Organize and schedule your activities

I’ll have more to say about both these things in follow-on postings.

Posted in Psychology | Leave a comment

Chopsticks & The Mouse

Under the right circumstances, usually involving very effective marketing, a genuinely poor technology can reign supreme, vanquishing superior technologies or preventing them from developing.

The fact that over a billion people eat their food with chopsticks proves this principle beyond any argument. In China the Johnny-come-lately technology of knife and fork just never stood a chance. And once a technology gets as dominant as chopsticks, nobody even questions whether it’s a good idea.

Chinese cuisine is what it is, because of those goofy chopsticks. It offers a wide variety of dishes, usually eaten with rice or noodles, with the meat or vegetables in every dish cut up into small chopstick-manageable pieces. Each dish will likely have a sauce which handily sticks grains of rice together, so that they too are chopstick-manageable. And, imho, Chinese cuisine is amongst the tastiest cuisines in the world.

You see, the dominance of a lousy technology may appear to have positive consequences. Chinese cuisine would not be what it is, were it not for chopsticks. It would be something else.

Despite this positive outcome, we cannot logically conclude: “therefore chopsticks are a good thing”. They are not, they’re ridiculous.

What has this got to do with Productivity?

Just one point, things are not what they seem. What looks like a clever idea can have many drawbacks.  I’m not about to have a long rant against the mouse, but it is worth noting that nobody ever gets taught to use a mouse. Let me explain:

There are three modes of working with a desktop computer:

  1. Two hands at the keyboard – highly productive for most applications.
  2. One hand on the keyboard and one on the mouse – less productive for most applications but most productive for graphical applications. (Note that if you’re left handed this is a different and probably more inconvenient experience – keyboards are build for the right-handed.)
  3. One hand on the mouse – usually least productive.

When should you be using which approach? The answer to this depends on the context, but to some extent also on the mouse you have.

The original Apple mouse hand but one button. Steve Jobs kept to this for years and it was, no doubt about it, dumb. Steve Jobs is a genius in many ways, but he got snakes in his head when it came to the mouse.

Here’s one of the main things that is wrong with the mouse:

It’s easier to explore a new piece of software using the mouse than it is using the keyboard.

We actually tend to do that in mode 3 (as described above.) We lean back and mouse around. The consequence is that the first way we learn to do most things in a new application is via the least productive mode of using the computer.

That wouldn’t be so bad if we got into the habit of learning the mode 1 way of using the application later on, but most of us don’t.

Posted in Psychology | 3 Comments