Skip to main content


Showing posts from October, 2021

How do programs work on a computer? (Part 1/2)

Let's take a very simple program for understanding how this system works. The following example is a very basic C code that assigns 2 variables (x and y) and then adds them to generate a value 'z'.  Note: We do not output anything in this program void main() { int x = 3; int y = 4; int z = x + y; } But we have a pressing question. Computers inherently work on electronics and logic, so how does it understand and execute the program? The answer is not very simple and you have to bear with me through a tiny journey. Basic Logic Circuits Let's first begin with a very basic Circuit which implements AND logic and OR logic (skip if you are familiar)  As seen in the circuits above, for the left circuit, the LED lights up only when both switches are on. This is AND logic as "Switch 1 AND Switch 2 need to be on". In the circuit on the right, either of the switch will switch on the LED. Note that in the

Photons to Photos

Hello, I am a photon, and my name is Mike! And today, I am going to describe how my friends and I became immortal. Well, almost immortal. As you see, my current state is very similar to Lord Voldemort. I have multiple copies of myself today, and if all of those copies die, I die. But no, I am not evil and certainly not a child murderer. So, let's begin! The beginning I do not remember where I was born. All I remember is that I was suddenly travelling at about 299792458 m/s, travelling through emptiness. There were, I don't know know how many of us there. It was about 500 seconds later that we suddenly slowed down a bit. And instead of travelling straight, we were starting to go off in different directions! We had just entered the atmosphere of a planet the natives call "Earth", and the others call "TerraForma" or "Terra" for short. This planet had an atmosphere, and because of it, many of my peer travellers deviated somewhere else or lost energy o

Travelogue of the click (Deep Dive)

 Warning: This article goes scuba diving into the depths of computer systems, networks, security, and many other fields and is not for the faint-hearted. It is okay if not everything in this article makes sense to you, especially if you are an undergraduate or have just graduated. Also, this article will take a lot of deviations to go explain some technology in detail. This article will refer to the previous two articles and their sections: Everything that happens when you search on Google (Part 1/2) Everything that happens when you search on Google (Part 2/2) Attribution and License: Touch Input Most of today's smartphones contain a capacitive touch screen. A capacitive touchscreen comprises 2 layers, each having a grid of units of some conductive material. One of the layer's units are connected row-wise, and the other's column-wise. Those 2 layers are separated by an insulator, and one of the layers is negatively ch

The small click returns (with results) (Part 2/2)

Let us continue from where we left off. That is from the time when your request's packets were delivered to Google's Data Centre. At Google's Data Centre (Cloud Computing) Your request has now travelled through multiple routers and switches throughout the internet and reached a google Data Centre (DC).  This is a specific request, which is requesting a search result, and hence it hit a DC.  Suppose this was a generic request like the homepage of google or the login page of Facebook, which is static (constant) and does not vary. In that case, your request may not even go all the way to a DC of Google/Facebook and instead be served by something called CDNs (Content Distribution Networks). CDNs are servers that store and serve static files like HTML, CSS etc. So, if you open Facebook and login, the HTML, CSS and JS of the page, i.e. content like the formatting, background colour, feed blocks, sections, icons like home and settings etc. are served by CDNs The loaded Javascript

A small click goes a long way (Part 1/2)

Have you ever wondered what actually happens when you type something in the google search bar and press 'Enter'? It's a pretty massive collection of some very complicated sets of systems interacting with one another. In this article, I will break down each of them for you. For the sake of simplicity, I will assume some things. For example, I will assume that you are on an android phone using a chrome browser and are doing a google search. The assumption will mostly be stated whenever there is one. With that, let's dive into what happens. Each subtopic is formatted as "Event (Education field related to it)." Attribution and License: Touch Input (Digital Electronics) As soon as you press the "Google Search" button on your screen, the following things happen: Your phone has what is called a capacitive touch screen. As soon as you tap on the screen, there is a ch

Introduction to Compilers and Interpreters

For humans, it is easier to understand languages written from a script we are familiar with, like the Latin A-Z alphabets or the Devanagari script of northern India or others. But for a computer, it is much easier to understand binary. That is 1s and 0s. This is so because the computer essentially works with electronic circuits, and all you can do with them (easily, at least) is switch them on and off, hence the idea of 1 and 0. You might say that you can also vary voltage or current, but that is not something we can do accurately, and hence it is difficult to introduce them into computing. You don't want the result of 1+1 to be 2.0000001, do you? Attribution and License Information: Anyway, there are 2 types of programming languages in the world: 1. Compiled (e.g. C, C++, Java, Go, Rust) 2. Interpreted (e.g. Python, JS) The code written in any compiled language has to compile, producing an executable that you can run. Whil

A beginner's introduction to WebAssembly

So you know how one day you are writing "Hello World" in C, and the next day you are figuring out which pointer/reference goes where in a thousand line code? It's weird! Pointers in C are an excellent way to gain low-level control, but your average developer is usually not that careful and creates a mess of pointers more often than not. And it takes a lot of extra effort to be careful when playing with pointers in C! Another major problem, which affects even the relatively newer languages, has something to do with importing modules. All the modules you import while writing the code run with the same privileges as the main program. You write the main program and know it is not malicious. But almost no one bothers to check if the modules they imported are doing something they are not supposed to do. This becomes a more significant concern with technologies like NodeJS and npm. There are literally thousands of modules imported because a module you import will probably impor