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:
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.