Sunday, 4 November 2012

Context Switching and Multitasking

Although not specific to testing I feel that software development, particularly in an agile environment, can lead to a lot of inevitable priority changes, sometimes several times a day.  Depending on the urgency of the new priorities this may mean people have to immediately stop focusing on whatever task they are currently involved with to start working on the latest precedence.

This change of attention from one task to another is known as context switching.

The Wikipedia definition of Context Switching refers to computers rather than humans but I feel the definition below can equally apply to people.

A context switch is the computing process of storing and restoring the state (context) of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. The context switch is an essential feature of a multitasking operating system.

Wikipedia also has the following definition for human multitasking:

Human multitasking is the best performance by an individual of appearing to handle more than one task at the same time. The term is derived from computer multitasking. An example of multitasking is taking phone calls while typing an email. Some believe that multitasking can result in time wasted due to human context switching and apparently causing more errors due to insufficient attention.

The notable word in the paragraph above is 'appearing' as I think multitasking, by definition, means one cannot devote 100% of one's attention to more than one task at a time.  As I write this I happen to be watching Match of the Day 2 and I know that this blog is taking a lot longer to write than if I was not looking up every time a goal is scored!  A perfect example of how not to multitask.  In my opinion multitasking is rarely effective, where a focus of attention is required, in achieving time saved and a better quality of work, than working on the same tasks sequentially.

A very important aspect of context switching is not the fact that what you are doing changes, but the fact that some amount of time is used up in getting your mind into a state of focus and readiness for the new task.  In testing, this may extend to getting your environment set up for the new task as well as having to start thinking about something new.  With several context switches per day this wasted time can soon add up.

Interruptions can come in many forms such as meetings, background conversations, questions, lunch, phone calls, and e-mails to name a few.  There are measures you can take to minimise these interruptions such as wearing headphones and turning off e-mail.  Some people use The Pomodoro Technique so they should be left alone for at least 20 minutes at a time.

Personally, I feel  there are positives in having at least two things to work on (but not at the same time) so that if what you're working on becomes blocked then you can start work on the second.  The key is to remain in control of this switching so as to limit the time 'wasted' in re focusing on the new task.

One of my weaknesses (if it can be seen as such) is that I find it difficult to say no to someone who asks me to look into something for them.  Sometimes I even welcome the interruption if I happen to be stuck in a rut with what I'm currently doing.

Going forward I feel I need to be more aware of my own context switches and I will be trying to reduce these only to those which are absolutely necessary or beneficial, and I would urge everyone to do the same.


  1. Great article Andy.

    I have seen this problem so many times and part of the issue is that interruptions and context switching is trivialised as a fact of life. It is actually a fact of culture - some organisations take this very seriously, not by introducing rules, but by example. If a CEO is careful when they need your time and doesn't simply switch you into their own request, the behaviour quickly spreads through the organisation.

    I also wrote on this subject

  2. Cheers for your comment Steve. After another busy day at work I realise that context switching effectively is a lot easier in theory than in practice!