Tram of Thought: Comic strip about psychology, philosophy, society, engineering, and just life in all its gory glory

Critical

Two CPU cores are shown with fierce expressions, pulling on a 1 in opposite directions.

Most of computers today have more than one computational unit within the processor package. For cheap consumer-grade electronics this is usually 4 cores, but this can go much higher. For example top-shelf workstation-grade AMD Threadripper has 96 cores and latest planned Intel server-grade processor package can contain up to 288 cores 🤯

Lots of cores is great, because a lot of useful work can be done in parallel, speeding up your browser, your game, your spreadsheet or everyone’s favourite website. But lots of cores can also be bad, because computers contain other resources that can become a limiting factor - for example your storage device may not be able to keep up with all these thread-ripping cores!

With many cores comes another problem - existence of critical sections. These are sections of programs that should never be executed in parallel because they operate on a common piece of data. In general-purpose computers, direct simultaneous access to the same memory area from multiple cores is specified as having an undefined outcome. This can lead to crashes, lock-ups and data corruption. Programmers can spend a lot of time making sure this sort of thing does not happen. This struggle for access to the same piece of data is depcited in today’s comic.

So next time you try to access a shared resource that is currently in use - such as a TV or a doorway - you will know you have reached a critical section and you should back off in case the undefined behaviour leads to universe collapsing.

#computing