FIRST PRINCIPLES FOR COMPUTING

We all know what a computer is. Do we?

Utkarsh Mishra
4 min readJul 24, 2020

A conversation from a second year CSE undergraduate classroom

Teacher: What is a computer?

[students thinking — “what a dumb question”]

Student: Something that we can instruct or program to do some actions

Teacher: You can keep something on a table, hence instruct it to keep it still and it will do that. Is ‘table’ a computer, then?

Someone answered: Sir, something that has inputs-keyboard, mouse etc., a processor or computing unit and a way to display the output-a monitor, speaker.

Teacher: Okay, what does computing unit do?

Student: Some kind of computation

Teacher: Okay, so what is computation?

Some badass student: That which a computer does!!

[everyone laughing]

This conversation was from one of my lectures at college. Soon after laughing, the looping discussion continued, and I realised that it wasn’t a dumb question. Most of our answers are implementations of computers or describe what we can do with computers or close yet not complete definitions. None thoroughly explained computers as we think of it. What the professor was seeking was a conceptual explanation — A first principle definition of computers!

The answer was — Alan Turing and Von Neumann. And even before we proceed, I would like to clarify that this forms a first principle definition for ‘modern’ computers[1]

Alan Turing and Von Neumann

DEFINITION OF A COMPUTER:

‘A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming.’

[ source Wikipedia ]

MAJOR THEORIES THAT LED TO THE COMPUTER AS WE KNOW IT:

Alan Turing conceptualised the ‘stored program’ concept: the idea of storing program instructions in an accessible memory just like data (ubiquitous today). He said, a computer implementing ‘stored program’ will have full problem-solving capabilities of a machine that can be programmed. This was a breakthrough, and many alternative architectures were designed to implement such a computer.

Our modern computers have a Von Neumann Architecture (implements the stored program concept):

  1. A processing unit that contains an arithmetic logic unit(ALU) and processor registers
  2. A control unit that contains an instruction register and program counter
  3. A memory that stores data and instructions
  4. External mass storage
  5. Input and output mechanisms

An ALU is capable of performing basic arithmetic and logical operations on two operands like addition, subtraction, maybe multiplication (repetitive addition). It is all hardware. Registers are similar to memory just that they are accessible directly by the ALU and are very fast. The rest of the architecture does magic. It takes this basic ALU with a processor register or together called the processing unit as a fundamental block and allows us to do everything possible you can think of — from playing GTA 5 to running an AI-powered search engine like Google.

Half-Adder Circuit

I will pause and talk a bit about ALU- which has subtle magic of its own. It is a circuit of logical gates (AND, NOT, OR, etc). These gates are made possible due to transistor, specifically the power of transistors to produce a low signal as an output, given a high signal on some input. So, now you can ‘NOT’ signals. Similarly, it allows making AND, OR and other gates. The diagram below shows how can add two-bits using such gates. What’s left is now just to extrapolate this concept and build complex stuff (the entire ALU) — simple, right?

The story ahead is relatively longer. But in a nutshell, it’s about — how machine code(binary language that a computer understands) stored in memory is executed using the control unit and the processing unit → How programming languages(JAVA, C) are compiled into such a machine code → What makes running programs so simple by giving us a way to leverage computer resources easily? The Operating System. [2]

YOU AND OS

But now you know, that whatever you do on a modern computer is based on Von Neumann Architecture. Whatever you do on a computer- from a click to run a program, it all gets finally converted into machine code and is executed by a processor that only knows how to add, subtract, do a logical ‘and’, etc.

HOPE YOU ENJOYED :) Find me on Twitter

NOTES:

  1. Older computers include Charles Babbage’s mechanical computer and so on.
  2. It is the same processor that does the conversion from high-level languages to machine code. Hence, the most basic compilers must be written in machine code.

--

--

Utkarsh Mishra

CS, Physics, Evolution, Philosophy and anything interesting — I can think all day!