Context Switch - The only operation that kills productivity

·

In computing, a context switch is the process of storing the state of a process or of a thread, so that it can be restored and execution resumed from the same point later. This allows multiple processes to share a single CPU, and is an essential feature of a multitasking operating system.

Wikipedia

See, a single core CPU can not multitask. It is all a lie. What really happens when single core CPU multitasks, is that it runs small parts of each program for a small period of time. The higher the IPS of the CPU, the more “multitasking” the CPU looks.

But in order to “multitask”, the OS needs to perform one very expensive operation — Context Switch. What happens in that operation is that it needs to store all the data of the current running program: its CPU registers and flags. Then unload the current program from the CPU, load the next program to the CPU, load its CPU registers and flags, and let it run for some small amount of milliseconds (somewhere around 100, depends on the OS scheduler implementation), until the OS decided to perform another context switch.

This is probably the most interesting and critical part of designing an operation system. If your context switching algorithm sucks, your OS becomes irresponsive, slow and eventually hangs.

We are like single core CPUs

Humans can not multitask. The brain is created to perform one task at a time.

It looks like you multitask sometimes, but what actually happens is that you, like an OS, perform context switch. And as in OS, your context switch is a very expensive operation.

Try to answer a phone call during intensive, brain required, work. Chances are you will forget most of the content of the call, because it takes your brain time to leave what it was doing (thinking and analyzing) and switch to another task (listening and remembering), not to mention that once the call is over, it will take you on average 25 minutes (No Task Left Behind? Examining the Nature of Fragmented Work) to go back to the task you were doing.

Some people are better at it (especially women), some are less, but for everyone — context switch is the productivity killer. It doesn’t matter if you wake up at 4am every day, eat healthy, do sports and read books — if you do a lot of context switching during the day, you won’t be as productive as you could be.

And it seems like no one in the modern world understands it.

Instant messaging, annoying notification pop ups, frequent meetings, open space work environment — all those and others encourage context switching. And thus — reduces productivity.

What can we do?

As someone who needs his full brain power, you need to tweak your working environment towards less context switching. Disable most of the notification — honestly they are not that important most of the times. Put your phone on silent; disable notification pulse lights and sounds; use headphones with relaxing, instrumental music; avoid meetings; practice concentration through meditation.

And avoid instant messaging — not only it distracts you from your tasks, but it is not an effective way for communication. It is great for things like “see you tomorrow at 6pm on main street 1 cafe”, but its awful tool for real conversations. You never have the full brain capacity to read, analyse, sympathize and respond correctly. In order to actually do all this, you need to dedicate time to real communication as opposed to communication “by-the-way”. This is also true for offline communication — never go watch a movie if what you want is to communicate, instead prefer a walk or a dinner with drinks; those are better for communication rather than the constant context switch between the movie and your partner / friends / family.

And if you are a manager who looks to increase the productivity of your team — promote quite times; drop those useless meetings or schedule a meetings day — a day that is dedicated entirely to meetings; prioritize — not every small email is important right now; promote documentation of your team’s members work, so team members wont spend time asking one another about parts of team’s work they were not involved in; promote non peer to peer communication — avoid IMs, prefer issue tracker that can be handled when the person has time to.

The key is FLOW

In positive psychology, flow, also known as the zone, is the mental state of operation in which a person performing an activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity. In essence, flow is characterized by complete absorption in what one does, and a resulting loss in one’s sense of space and time. — Wikipedia

Flow is the new trend today. Be in the flow. Whether its work flow, conversation flow, listening flow, watching flow, reading flow. Your brain is not capable of doing multiple things at once, it performs best when its in a flow state. Embrace the flow. There is a reason why people experienced flow state describe it as the most productive work they’ve done. It is because in the flow you have only the sense of the task, you do not spend any energy thinking about or concentrating on different tasks or areas.

Multitasking is not the answer

We keep hearing a lot about how multitasking is important; the world has gone crazy and we need to do a lot of stuff in order to succeed. “Being able to switch between different tasks fast”, “Can work in a fast moving environment” — those are one of the common job descriptions you can find today, and the ones you need to avoid.

The only way to succeed is to devote your full attention to the particular activity, whether its work, communication, reading, doing sports, meditating. Really successful people know how to plan — plan work, plan leisure, plan everything. And they know how to disconnect — leave your work behind when you spend time with family; leave your trip planning behind when you work and etc.

Avoid multitasking; avoid being flexible; avoid working in a fast moving environment. You will not succeed there. You might feel like you are, but what actually will happen is that you will break down. Break down because multitasking does not work. The only thing that multitasking does to you (apart for the health problems it is associated with such as: brain harm, memory problems, increased distractibility, chronic stress, depression and social anxiety)— it makes you do mediocre work in more time; makes you spend your potential on stress; makes your brain keeps wasting its power as well as your energy, to a very expensive operation — Context Switching.

Share this:

Published by

Dmitry Kudryavtsev

Dmitry Kudryavtsev

Senior Software Engineer / Tech Entrepreneur

With more than 14 years of professional experience in tech, Dmitry is a generalist software engineer with a strong passion to writing code and writing about code.


Technical Writing for Software Engineers - Book Cover

Recently, I released a new book called Technical Writing for Software Engineers - A Handbook. It’s a short handbook about how to improve your technical writing.

The book contains my experience and mistakes I made, together with examples of different technical documents you will have to write during your career. If you believe it might help you, consider purchasing it to support my work and this blog.

Get it on Gumroad or Leanpub


From Applicant to Employee - Book Cover

Were you affected by the recent lay-offs in tech? Are you looking for a new workplace? Do you want to get into tech?

Consider getting my and my wife’s recent book From Applicant to Employee - Your blueprint for landing a job in tech. It contains our combined knowledge on the interviewing process in small, and big tech companies. Together with tips and tricks on how to prepare for your interview, befriend your recruiter, and find a good match between you and potential employer.

Get it on Gumroad or LeanPub