How does a Computer work?
How does a Computer work?
As humans we always built tools that helps up to solve our problems. All the early inventions unlike wheelbarrow, hammer, printing press, or a tractor, helped up with the manual work. Over time people became more intrigued and began to wonder if a machine could be designed and build to help them with the thinking and analysis that we do. For example, solving equations, tracking the stars in the sky, forecasting weather, etc.,
These machines were primarily built to store and manipulate the information and named as COMPUTERS. The computer uses binary language and perceives the information in the form of ones and zeros then, It combines them into more complex things such as a calculation, videos, audios, photographs, a website, games, and much more.

How Computer Functions
The computer performs basically four major operations or functions which are as follows:
- ACCEPTS INPUT UNIT IN THE FORM OF DATA AND INSTRUCTIONS (INPUT DEVICE)

Instructions are sent to computer through input devices. Some of the input devices are keyboard, scanner, and joystick. Data or programs are entered into the computer system through these devices. Input units take data from us and forward it. The most important input device is the keyboard which takes words, figures, and commands from the operator. The second important devices a mouse which selects options from the menu is displayed on the screen. There are some other input devices also such as scanner joystick microphone track ban etc.
- STORAGE (RAM)

The process of saving data and instructions is known as storage. Once the data has been entered into the computer, it must be stored somewhere to CPU can start the processing. The computer component used by operating systems and applications to temporary store data is called Ram or Random Access Memory. The central processing unit's processing speed is so fast that the data must be provided to the CPU at the same speed. Therefore, the data is stored in RAM for faster access and processing. It stores the pre and post data processing instructions and the intermediate results of processing. RAM is volatile, i.e., once the computer is shut, all the data stored on Ram is wiped off permanently. Hence a backup in the form of Uninterruptible Power System (UPS) is often used to prevent the data loss.
Another storage device is Hard Disk Drive or HDD. It is the storage unit used to store all your data, photos, apps, videos, audios, and documents.
- PROCESSING OR CPU

The task of processing Operations, like arithmetic and logical operations, is called processing. The CPU or Central Processing Unit takes data and instructions from the storage unit. It makes all sorts of calculations being stored the instructions given and the type of data provided. The processed result is then sent back to the storage unit as a result.
A computer CPU is composed of millions and billions of transistors. It is also known as microprocessors due to its size. With modern technology, the CPU has advanced and evolved, and today is using ‘integrated chips.’ These chips are made up by combining several types of competence into a single piece of Silicon. The CPU is incorporated directly into the motherboard or a CPU socket pin side down.
Functional Unit of CPU

The central processing unit is divided into three functional units based on the work they do. These are as follows:
- The Control Unit (CU): The control unit controls all the computer operations. The control section directs the flow of operations and data. The control unit performs all operations like input processing and output, which takes care of step-by-step processing of all operations inside the computer, the central processing unit. It accepts data in the form of programs and instructions through the input unit and stores it in the memory. It fetches all the information stored in the memory and displays the processed information through the Output Unit.
- The Arithmetic Logic Unit (ALU): ALU is one of the most powerful components within a computer processor. The ALU performs mathematical, logical, and decision making operations on a computer. After the ALU has processed the information, it is sent to the computer memory.
- The Main Memory Unit or Internal Memory (MMU): MMU stores the data and instructions on which the computer is currently working. The memory unit is made up of a semiconductor device and has limited capacity. Thus, the data gets lost when the power is switched off. It is further divided into RAM and ROM.
- DISPLAY THE RESULT THROUGH OUTPUT DEVICES

Now the CPU has processed the data and fetched the output. Next, the processed output must be kept somewhere inside your system to compute the further processing play. The output devices such as Monitor, Printer, etc. displays the output given to you in a human-readable form.
How information is represented inside a Computer

Computers are changing the world at a fast pace. You will find this revolutionary machine almost in every sector and are used daily. In the above segment we briefly had a look at the different parts of the computers that actually input, output and store all the information and later process it and generates the output. In a nutshell, we learnt what makes a computer a computer. But that not enough because that is only the functional and operational behavior of the computer. We all know computer uses binary language to operate the data. But have we ever thought how this information is represented? or by what means it can only read the 0 and 1 number. The answer of the above questions are electricity. Yes, information is represented inside a computer using electricity. Computers use tiny electrical signals which went on and off and generated the output. Not only this, computer use circuits to do everything from simple math to stimulating complex computations.
Electricity at Atomic Level

Atoms are made of protons, electrons, and neutrons where protons are positively charged, electrons are negatively charged, and neutrons are neutral (without any charge). At the center of the atom, there is a nucleus where protons reside; on the other hand, electrons hang around the nucleus. Atoms in their standard state have an even number of protons and electrons. Thus, the positive and negative charges of the protons and electrons cancel out and balance each other. But if you add an extra proton to the add, it will make the atom positively charged, and the opposite happens if we take away a proton, you’ll have more electron, which makes the atom negatively charged. Some atoms are willing to give away their electrons while other don’t.
Conductors, Insulators and Electricity

Electrical wires are made up of protective rubber-like coating with metal strips inside. Electricity usually involves metals because metals are more willing to give up their electrons. Hence, the metals fall under the category of Conductors. Conductors are made up of many atoms, string together that want to give up their electrons. When you plug the cord into an outlet, it gives electrons to the metal atoms that it touches.
Since metal atoms like to give up, electrons and electrons travel from one atom to another from one end of the wire to the other. This how the Electricity flows inside a wire. In a nutshell, electricity is generated when many electrons hop from one atom to the next. Electric wires have a rubber-like coating knows as Insulators, which prevent the flow of the electricity. Insulators are the atoms that don't like to give up electrons such as rubber, wood, etc. It is the reason when you touch the wires, and you do not get any shock because the insulators are stopping the flow of electricity.
Semiconductors

There are other types of atoms called Semiconductors that are in between conductors and insulators. They pursue both the features, sometimes they give their electrons, but other times they want to keep him out. Computers today use a semiconductor that goes by the name of Silicon. It doesn't know whether to share or not to share its electrons. So, to manage the flow of electrons, a process called Doping is used. Doping involves the modification of Silicon to tend toward giving up or keeping the electrons. Silicon is doped in two different ways:
- p-type semiconductor: Dope to keep its electrons
- n-type semiconductors: Dope to share its electrons
Transistors

Transistors are the most basic unit of computer which is made by combining the p and n type semiconductors together. We take our N type semiconductor and we put it on the ends and sandwich the P type between them. So, on one side of the transistor there is a source (where the electricity comes from) and on the other side of the transistor is the drain (where the electricity is trying to flow) to remember.

But in between then we have doped p-type semiconductor. The electricity flows fine through the N-type but it reaches P-type, they cancel out each other making a wall that stopes electron from flowing from the source to the drain. This block in known as depletion zone.

On the top of the transistor we locate a Gate which emit out charges and acts like a switch. When a positive charge is applied to this gate, it attracts the electrons across the depletion some affectively shrinking the depletions of it allows electrons to flow freely from the source to the drain. The gate is used like a switch. When the gate is off electricity can't flow through but when the gate is turned on the electricity can flow through. Based on the same concept the binary language of the computer works.
Transistors and Binary Language

Computers work by aligning a bunch of transistors and generates a string of zeros and ones. Computers use millions to billions of transistors, which are lined up together to perform complex math equations, display color, play sound, put video, etc. The combination of 0 and 1 depends upon the operation performed by the computer. For example: If your computer is performing a math equation, then 01001110 would be equal to 46, but if you are trying to display a video, the same combination of zeros and ones in the graphics portion of your computer stands, for a specific shade of green.
Gates

Computers are precisely used for performing math and logic activities, which they attain by stringing along a bunch of transistors in a different configuration. These configurations are known as GATES (AND, OR, NAND, NOR, NOT). Gates are named after what they do and work by stringing transistors together. Many logic gates can be string together in different patterns, which enables the computer to perform complex instruction sets designed by computer programmers.
For example: In the 'AND' gate, the electrons try to flow from the source to the drain of the first transistor and move to the second transistor source. Let's analysis the different cases where the two transistors are placed together to generate an output:
Case 1: If both transistors are off:
The off-state represents two zeros; thus, the electrons cannot make it to the final drain. Thus, the output will be zero.
Case: 2 If One Transistor in On and other is Off:
If one transistor is on which is a 1 and another is off, which is 0, then the electrons stop at the off transistor and will not pass it through, resulting in a 0.
Case 3: Both Transistor is 0:
If both transistors are on, it makes two 1, and the electrons will be able to flow through the source of one transistor to the drain of another. Thus, the gate will give the result as 1.
Hence, transistors are configured in different ways to make different logic gates that spit out ones and zeroes, which strung together and make numbers, letters, and colors.