Interaction of a Program with Hardware
When a Programmer writes a program, it is fed into the computer and how does it actually work?
So, this article is about the process of how the program code that is written on any text editor is fed to the computer and gets executed. As we all know computers work with only two numbers,i.e. 0s or 1s. Let’s have a look at the entire procedure of how a code that is written in general language is translated into 0’s and 1’s.
Interaction of a Program with Hardware- The step-by-Step Procedure
1. We write code in a text editor using any language like C++, JAVA, Python, etc.
2. This code is given to the compiler and it actually converts it to assembly code that is very close to machine hardware as it depends on an instruction set which is then converted to the binary that is 0s and 1s which actually represent digital voltage fed to transistors inside the chip.
3. Now we have voltages that are actually required to run the hardware. These voltages actually connect the correct circuitry inside the chip and perform that specific task for example addition, subtraction, etc. All these operations are done by the combination of little transistors if we go into low level or flip-flops which are the combination of gates and gates are a combination of transistors. So, it all started with the invention of transistors.
4. The chip or microprocessor has a lot of circuits inside it to perform various tasks like arithmetic and logical task. The computer hardware also contains RAM which is another chip that can store data temporarily and a Hard disk that can permanently store data.
5. The operating system is also responsible for feeding the software to the right hardware like the keyboard, mouse, screen, etc.
The following image depicts the entire procedure:
Initially, a programmer writes code in the text editor, then the code is compiled, after successful compilation, the code is translated into Assembly language, Once the code is translated into assembly language, it is the responsibility of the assembler to translate the code into machine understandable form or binary form. So, the assembler converts the code into 0’s and 1’s series. After this, the series of 0’s and 1’s is executed on a Hardware chip or microprocessor to produce the result.