Before directly jumping deeply in c++, let's first start by creating the roots of computer science.
In this post we will answer the following question.
- What is Computer and How it works?
- What is Program and Operating system?
- Low Level vs High Level Language?
- Compiler v/s Interpreter?
By Knowing All these basic concepts You will be able to understand the upcoming more complex concepts easily.
Let's start answering the above questions.
What is Computer and How it works?
What is computer?
If I answer briefly, what is computer? then it is just a calculator used for doing simple calculations. If I have to answer where is computer used?, then I could probably say everywhere. We are surrounded by computer, for example mobile, smartwatches, and personal computer (obviously).
The below image is the first mechanical computer that we used for calculation.
Abacus |
How computer works?
The computer's internal functionality is a whole separate branch. We will discuss only the required knowledge.
The computer has two main parts the CPU(central processing unit) and main memory.
CPU is the device where all the calculations are held, It is made with various electronic components.
Let me discuss them one by one.
- Register is just an storage device(but then what is main memory? It's a storage too). Registers are small and quick memory devices that are used to quickly access the next operation to perform. Here you must be thinking what is meant by next operation. Let me explain, as we know computer operates on data with sequences of operations, and registers simply stores the next operation to perform present in that sequences, there are various types of registers, click here for more info.
- Arithmetic Logic Unit(ALU) is the part of the CPU where all the calculation on the data happens. You can clearly see the registers pointing to a shared place between ALU and CU(control unit). It means, registers are accessible by both ALU and CU and it can easily tell them what to perform next.
- The control unit (CU) is a component of CPU that directs the operation of the processor. It means that it handles computer's memory, ALU and input output devices to tell them how to respond to the given instruction.
- Bus, you can relate it to the real one too. What Bus do is to transport passengers. Here the passengers is simply not the human or dogs or anything else.. but the data.
- Main Memory is a temporary storage device, now what the word "temporary" doing here. Let me explain this through an example, if you have windows installed in your system then open task manager using the shortcut ctrl+shift+esc and note down your memory(RAM) usage, now, If you have any heavy game or any application then go and start it(don't forget to come back) now again open task manager and you will see that memory usage is increased, and if you close that program it will again released. Now, this is what temporary means, when you start anything in your computer it do not start directly from your hard disk but firstly it will be transferred to the main memory and after that it will open and after closing the program it is also be deleted from the memory too.
When you given some input to the computer it will first stored to the input buffer, so that CPU and main memory can access it.
After Accessing input from the user the operations are performed on the data by CPU and again the data is transferred to the output buffer, so that Some output device generally we have Monitor, but it may be printer and anything else, can access that data.
(Extra thing to remember - Computers uses machine language i.e. 0s and 1s but not the English or french or any other language. I will discuss it in more details in future.)
What is Program and Operating System?
What is Program?
A program can be considered as a set of ordered operations that computer perform.
What is Operating System?
An Operating System is also a program but it is the most essential program that a computer needs to run. When you turn on the switch of your computer(assuming that you have electricity supply), the first thing that computer do is, it loads a program, wait ๐ค which one? Our most precious The Operating System. The process that how loading is done is similar as I have discussed in the main memory section.
Low Level language v/s High Level Language
- High Level Language is easy to read but Low Level Language is not.
- High Level Language is easy to debug but Low Level Language is not.
- High Level Languages are much more used as compared to Low Level Language(Who wants to do difficult things๐ฉ.)
- High Level Language needs compiler or interpreter for translation while Low Level Language needs assembler.
Compiler v/s Interpreter
The functions of compiler and interpreter are same, to run the given code/program/kodikas(in greek)..
But(that's a big but), the approach of compiler and interpreter are different.
Differences are written below.
- The compiler converts the whole code to a separate stand alone machine code file while interpreter runs the given code line by line and do not create a separate machine coded file.
- There are terms like linking, object code etc, If you are familiar with them it's Good ๐, if not, then skip it for now, I will be discussing them in very detailed form in future๐.
(Extra thing to remember - C++ is a compiled language, don't worry we will discuss it too.)
Stay tuned for the upcoming content. For any query leave a comment below.
Click the Subscribe button at the top, to follow my every post regarding c++.
References -
- Wikipedia.
- GeeksForGeeks.
- Lippman, Stanley B. c++ primer 3rd edition(april 2, 1998).
Nic bro, keep it up
ReplyDeleteThank You.
DeleteNice knowledge
DeleteNice blog it's contains very good information
ReplyDeleteThank You.
DeleteGreat work boi
ReplyDeleteThank You.
DeleteGreat work bro. You take care of little - little things that is really good. That shows your dedication & hard work in Cpp.keep it up.
ReplyDelete