How computers actually work? Explaining the 3 levels of computers.

What everyone knows about computers

Most of you probably know what an operating system in a computer is. Many might say that the working of computer depends on the operating system. And below that, is our hardware, which includes things like CPU, motherboard, Battery, etc., to which the OS connects to make the computer operational. Well that’s absolutely correct, but this explanation of the working of computer is still incomplete. As it doesn’t really tell you how the things like OS actually connects to the hardware practically. It doesn’t explain how these these programs are even made.

And that is what this article will be about. It will explain the entire structure of a computer and how the interface you see on the screen actually corresponds to the hardware.

And in order to understand it, we will break the whole system into three layers

  1. The application layer
  2. The middleware (The Operating System)
  3. The hardware
Layers of a computer system
We will use this image for our reference throughout the article

The application layer

This is the layer everyone is most familiar with. It refers to everything including the apps, games, files, video etc. in the computer. I don’t think it needs a lot of emphasis in this article. So we jump right into the middleware.

The middleware(The operating system)

The operating system

I guess its easy for everyone to at least differentiate different devices based on the operating system. Some of them are windows, android, blackberry and IOS. Some developers might be familiar with ubuntu or mint. Each OS has unique design, look and features. For example windows is an OS specially made for computers, whereas android for mobile phones. Apple has IOS for its mobile phones and MacOS for its computers.

The operating system sits between the applications and the hardware. But how is this Operating system made ? Well there are many programs involved but the most important of all is the kernel.

The kernel

The kernel is the software in which an OS is written. For example, most of windows operating system, like 7 and 8 are written in the Windows NT kernel. There is an entire family of hundreds of OSes written in the Linux kernel. Ubuntu and mint being one them. MacOS is written using the UNIX Kernel. There is actually a really long history Unix and Linux which if you want to read about, you can refer to this wikipedia article.

If you have a little bit of experience with command line interface of Linux or Windows, you might know how tasks can be done using it. Well this command line interface is in fact, an access to the kernel itself. Remember an OS is nothing but an interface programmed by a kernel.

And now the question arises, how are these kernels made ?

To understand that, we need to first look at the types of programming languages.

High level language

A high level language is a language which cannot be directly understood by the machine(the hardware). They need a compiler to be converted into the machine language(a language the hardware can understand, a thing we will talk about later) to get an output. Some other high level languages, use an interpreter, instead of a compiler. Which gives and output without converting the code into machine language(you don’t need to worry about interpreter for now). Some of the examples are, Python, Java, JavaScript, etc.

Low level Language

A low level language on the other hand can be understood by the machine directly. There are basically 2 kind of low level languages, assembly and machine language. The machine language is the language of the hardware itself, 0s and 1s. So the hardware can easily understand it. On the other side Assembly language is a language which is completely derived from the hardware. Thus is not something like python or java which are usually the same for everyone. Assembly language is unique for every device , based on the hardware. And of course even an assemble language at some point is converted into machine language (0, 1) by something called an assembler.

These low level languages (the assembly language) are in fact the things we use to make a kernel. Along with that, a very famous language is used, which is C. Although C is compiled, it is not considered a high level language. Not even a low level language. It is something called a middle level language, and can be used for any situation.

Hence, another way in which you can differentiate between low level and high level language is by saying, low level languages are languages which can be only used below the kernel layer. Whereas high level language are used above it.

And yes at some point even these high level languages(compiled ones), are converted into low level language(machine language).

Basically there is a hierarchy of programming languages is like

High level language —–compiler——-> Assembly language —-assembler—–> Machine code.

The hardware

The hardware simple refers to the physical components like processor, motherboard, SSD etc of a computer. As you might remember, everything above this layer is, at its lowest level converted into Binary. Well Binary is the language of the hardware. This is exactly how the middleware connects to the hardware.

And what are these zeros and ones now ? Well this is, as might have heard ,the off and on position of a transistor. Off means, the electrons or the electricity isn’t flowing, and ON means, the electrons are flowing through the transistor

The way these 0 and 1 are actually interpreted by the hardware is out of the scope of this article. As its purely about Electronics.

3 thoughts on “How computers actually work? Explaining the 3 levels of computers.”

Comments are closed.