Computer Architecture Solutions for Gollu’s Mental Health

Biswabandan Panda
5 min readJul 16, 2020

This blog attempts to correlate the mental health of a human being with a modern processor core. For the rest of the blog, we assume a processor core is a human being, and a multi-core system is like a society with many human beings. The tasks performed by a human being are the instructions. The main memory is the uncomfort zone that may lead to depression, negative thoughts, chaos as it is shared by all. The figure below illustrates the analogy. The blog uses some of the concepts from the world of Computer Architecture. In case, you find some of them new or confusing, a web-search will help.

To make the blog a bit more dramatic, we introduce Gollu, one of the processor cores. Modern processors are way faster than processors of older generations. Thanks to micro-architects, the instructions per cycle (IPC, a.k.a. the performance) has gone up quite a bit. As the current processors are superscalar and out-of-order in nature that fetch more than one instruction at a time and execute instructions in an out-of-order way just to improve instruction level parallelism (ILP), Gollu started doing many tasks at a given point of time. Some instructions are simple arithmetic instructions that can be done in a few cycles, but there are LOAD/STORE instructions that go to the main memory and stall the processor for a long time. Gollu’s life is no different: he has to perform tasks that can be done in a few minutes, hours, days, and months. Also, one task can affect other tasks, the way dependent instructions affect each other in a processor pipeline. Gollu lives within a society (multi-core system) with other Mollu, Pollu,… etc. DRAM is a place that is not in the comfort zone of Gollu and that creates chaos, uncertainty, and rat race, causing a delay in tasks.

Caches are wonderful in terms of hiding DRAM latency, and the same is available to Gollu too. Gollu has his/her own strengths and skills (comfort zones) that he/she caches in his/her own private caches, and some are shared like the L3 cache of modern processors. Gollu’s performance is unaffected if he/she gets a response from his/her caches (the comfort zone), but as there is no ideal/perfect life like no cache that provides a 100% hit rate, Gollu has to go to DRAM to learn new skills so that he/she can tackle difficult and challenging situations in the future. Gollu also has to tackle interrupts and faults as unfortunate events that he/she has no control of. Faults are setbacks, interrupts are tasks requiring urgent attention (an emergency). Even a simple branch condition (whether to do or not) can make the life of Gollu miserable as it can start doing wrong tasks assuming it is right and later may realize the mistake.

Now, with this context, let’s look at the mental health aspect. At a 10K feet view, As per WHO, “Mental health is a state of well-being in which an individual realizes his or her own abilities, can cope with the normal stresses of life, can work productively, and is able to make a contribution to his or her community.”

Gollu is also in the pursuit of stable mental health. However, he does feel the pressure of completing more and more tasks and not handling it effectively may lead to (i) frustration, depression and always repenting, (ii) hopelessness, (ii) demotivated, (iii) thinking everything is going wrong in life, (iv) mind full of random thoughts leading to anxiety, (v) inability to cope up with normal stress (vi) excessive guilt feelings. Problems and problems everywhere ehhh! Now, let’s see how a modern processor handles these problems:

  1. Problem: Non-stop repenting: Solution: Not to jump to possible conclusions too quickly, it’s okay to be a little slow but correct in the long run. That is what the modern processors do to ensure the program order still remains intact even with out-of-order processors.
  2. Problem: Scared of uncomfort zone, Solution: Prefetchers that prefetch data into caches before time (hone skills in advance and come out of your comfort zone so that you will be ready to face any obstacle coming on our way). It is like reading good books and staying positive.
  3. Problem: Some situations are not in our control, Solution: we cannot avoid it but have to deal with it, just like there is an interrupt handler handling interrupts. Faults (failures in tasks aka instructions) are OK once in a while, but if we do not handle it properly, we can have Meltdown :)
  4. Problem: Not sure, what to do, what not to do, and that causes anxiety, Solution: think about branch predictors (the experienced folks in your life) in modern processors that speculate the future better and suggest which way to go. Talk to them. Learn from them. Don’t be too eager to learn/ do everything at once, prefetchers know when not to prefetch, it only wastes time if you prefetch something that’s not useful.
  5. Problem: We try to be at 100% even if the situation doesn’t demand it, that requires lots of energy and is not good for Gollu in the long run, leading to frustration, burn-out and eventually depression. Gollu should maintain the level of intensity and power as required by the situation, just like Dynamic Voltage Frequency Scaling (DVFS) varies the processor frequency as per the runtime load for power saving, and efficiency.
  6. Problem: Not feeling like talking to anyone. Solution: just communicating with other cores, maybe others have the skills you want and can lend to you so you don’t always have to take the long-hard route. Just like cache coherence protocols, Gollu should communicate to his/her friends, family members, so that everyone will be in a coherent state and may solve a problem/challenge collectively. Gollu might feel like he/she is an isolated core (even though other cores may help). This feeling can be changed by probing other cores, once in a while.
  7. Problem: Continuous negative thoughts and guilt feeling Solution: Just clear the processor pipeline, flush the troubling thoughts and state of mind (like a clflush instruction flushes caches), start afresh. Thinking everything is going wrong -> wrong predictions/ prefetches, again stop prefetching and learn what is it you’re trying to do.

It is not the case that Gollu has to perform his/her tasks all the time as humans have “free will”. In that sense, it is important to find a way to pick and choose the instructions that Gollu wants to execute, otherwise unnecessary instructions will obstruct the progress. In the computing system, OS comes to the rescue by de-scheduling a process or migrating a process, helping the processor to chill a bit :)

Disclaimer: As we can see, modern day processors are designed to take care of all the aspects that Gollu faces every day and there are plenty of solutions. However, if these solutions do not work, you should consult a doctor. While there are forms of depression that occur due to chemical imbalance that needs a doctor intervention, this blog is more concerned about psychological, mental health.

BTW, Who is this Gollu? You, me, our friends, loved ones, anyone, everyone. Take care folks. Make sure, you know how to handle your interrupts, exceptions, dependent instructions, and DRAM latency. Take care.

Special thanks to my mentees Anish and Vasudha for spending hours with me discussing various aspects of this blog. Thanks to my research group members, friends, and colleagues who helped me with their pointers.

--

--

Biswabandan Panda

Assistant Professor CSE-IITB, Computer Architecture/Systems && Computer Science Education