Basic Working Of Computers

Hey Guys. Today we will be learning about basic working of computers. How its processor executes commands and how its stored in memory. So firstly We can say that the computer is made up of very simple components doing simple things which eventually add up to perform a complex task.

Basic Working Of Computers

As you all would know, a computer has 3 basic components.  
  1. Main Memory
  2. Arithmetic Logical Unit
  3. Control Unit

Computer chips contains modules,which contains logic gates, which contains Transistors. We can say transistors as a simple switch, which either blocks the data or allow it to pass through it. This data can be called bits which is either 0 (low) or 1(high). Combination of such bits can be used to represent more complex information. These transistors are combined to make logic gates which can do very simple stuff.

Logic Gates

A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs and one output. At any given moment, every terminal is in one of the two binary conditions low (0) or high (1), represented by different voltage levels. We represent these inputs and outputs with truth table. They work on simple boolean logics.

So combination of these logic gates can be used to perform basic mathematical functions like add, subtract and multiply.

The picture above shows addition of 2 and 3 that is 5 by logic gates. So We can develop complex chips from these.


Now lets talk about memory. The commands to be instructed to the processor are stored in memory. These logic gates can also be used to store memory at least until the power is on. Now we want the processor to execute our desired commands and remember things. So we feed it to the memory in the form of 0s and 1s. It is assigned a memory address. Then the processor takes input from it and tells the output accordingly.

Programming Languages

Now lets talk about how we feed in the inputs to the computer. Well many people have doubt that if a programming language is made from programming language then how the first language was made?

Lets start with basic that computers understand only machine language. This includes codes understandable by CPU in hex, binary, assembly,etc. These were hard to remember and code. People used to write programs in assembly language. And convert them manually into machine code.This was much time consuming. Also as you would know punch cards were used to input before keyboards. Assembly language is more human readable.So to convert assembly language into machine language assemblers were made.The very initial assemblers were just written in 0s and 1s so as to get a very basic start capable of converting very basic small amount of code. Now this assembler is fed with assembly language to create a better assembler and so on so as to make better assembler. So what has been done is assembler for assembly language is made in assembly language. So the language is self hosted. This process is called "bootstrapping". Many of the programming languages today are self hosted like C, python, java,etc etc You can get a list online. The high level programming languages need a compiler or interpreter to translate them into machine readable form. Interpreter This translator, translates the input line by line at a time into machine language(0s and 1s). Compiler: It scans the whole program and converts completely into machine code at once.

What happens is the language is made from itself. Just the first building block to be made in another language. Its called cross compilation.At the end all high level language need to be compiled into assembly language then machine language or directly machine language. Thanks for reading. In future we will be heading to working of ram in more deep and exploits like buffer overflow.



Post a Comment

Popular Posts