Multitasking is popular because it gives the impression of being more productive (or at least busier!)
But science tells us it’s not true. The attention span of an average human is usually in the 5 to 7 chunks. And then there’s all the context. The more you multi task, the more context you have to re-load.
One efficient way of doing kind-of multi-tasking, is to use all the parts of your brain efficiently: you focus on a problem/task for some time, and when you’re stuck, then you switch to something else (again, for a minimum amount of time). Your conscious focus will switch from one task to another, but your brain will keep thinking about the other task, so that when you come back to it, you might make quick progress.
That’s part of the mechanics at work when people use the Pomodoro technique.
If you are not familiar with how your brain thinks and how the conscious vs unconscious thinking process work in parallel, a great introduction is this talk by Linda Rising:
When people are "successful" multi tasking, usually it’s because only one task really requires a full focus, and the other(s) one(s) can be automated and does not require any active thinking. Otherwise, the focus and the cognitive load is split and indeed, either the tasks are really simple, or they aren’t performed as well as they could.
As soon as a task requires some focus and concentration, your brain needs to be fully engaged.
The sooner a developer learns this, the sooner he improves on complex tasks.
Thankfully many tasks are dull and don’t require a full attention ;)