Computer Basics

A computer is an automated machine that can perform tasks by following set of instructions. A computer may be a desktop, tablet, smartphone or a toaster. These computers may be an electronic device or a mechanical device. The idea behind the computers is not bound to the electronic devices.

A computer may work as an analog computer or a digital computer. Analog computers are the computers that work on the continuous data on the other hand digital computers work on the discrete data. Digital computers are the most common computers that we use in our daily life because they have an huge advantage over the analog computers when it comes to the accuracy and the precision.

Lets give an example; lets say that we have a computer that just adds two numbers. If we would use an analog fluid computer, the numbers would be represented by the pressure of the fluid. Therefore, the adding machine would create a pressure in its output that will be match the sum of the input pressures.

On the other hand, if we would use a digital computer, the numbers would be represented by the binary numbers. In order to represent binary numbers as a pressure, we need to pick constant pressure values for 0 and 1.

Parts of a Computer

Binary Numbers (0s and 1s)

In the digital world, everything is represented by the binary numbers. Binary numbers are the numbers that are represented by the 0s and 1s. The binary numbers are the most basic form of the data representation in the digital world. The binary numbers are used to represent the numbers, characters, images, sounds and videos.

You may think that how is it possible to represent everything with just 0s and 1s. This question is a good question and the answer is not trivial. Lets see;

Lets we want to store whether a light is on or off then we can represent the light is on with 1 and the light is off with 0. However, lets say that we want to store the color of the light. Lets assume that the light have 3 different colors then we can represent the state of the lisht bulb with 2 bits. Therefore, there are 4 different possible states;

ColorBinary
Off00
Red01
Green10
Blue11

As you can see we can concatenate the bits to represent more complex data. These groups of bits have a name;

Number of BitsName
1Bit
4Nibble
8Byte
16Word
32Double Word
64Quad Word

However, generally people use hexadecimal numbers to represent the binary numbers because they have a more compact form. Hexadecimal numbers are the numbers that are represented by the 0-9 and A-F. Lets see the hexadecimal representation of the binary numbers;

BinaryHexadecimal
00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F

To make the distinction between the hexadecimal and the decimal numbers, the hexadecimal numbers are generally prefixed with 0x. For example, the hexadecimal number 0x2A represents 8 bits of data in hexadecimal form. Also for the binaries the prefix 0b is used. For example, the binary number 0b110 represents 3 bits of data in binary form. If we are using decimals then we do not need to use any prefix.

Lets say that we want to store a number by using the binary numbers. Simply we can convert each number to its binary representation. For example, the number 5 is represented by 101 in binary.

However, this method to represent the numbers is not enough to represent the negative numbers. Therefore, we need to invent a new method to represent the negative numbers. The simplest method to represent the negative numbers is making the most significant bit as the sign bit (leftmost bit). If the sign bit is 1 then the number is negative, otherwise the number is positive. Lets look at some examples;

Logic Gates and Transistors

CPU

Memory

Instruction Set Architecture (ISA)

I/O Devices

Summary

Exercises