# What is meant by CPU Burst and I/O Burst?

• A computer processor in 10 easy steps

Step 1:

Let you imagine a wire with a button in the middle. When you push the button, the electricity goes through, when you release it, the electricity is cut and can’t do through anymore. This button is called a transistor and it uses another electricity wire instead of your finger. This is the only tool we have.

Step 2:

Two buttons on one wire – AND gate – electricity goes through only when both buttons are pushed.

A button which is pushed unless you pull it – NOT gates. Electricity stops when you make an action – it reverses your action/signal.

Two wires connected on one end so either button is pushed the electricity goes through. – OR gate.

Step 3:

Now we need to know at least a bit about base-2 math. Look at the table here:

What we need to know for now is how we can encode number 0-3.

We will use two wires. zero means “no current”, one means “has current”

00 – means zero

01 – means one

10 – means two

11 – means three

Step 4:

Let’s have 4 wires and let me think of a number 0-3 and the device will select the wire I want by setting up my two wires to the needed number and it allows just the selected signal to go through. It is called a multiplexer.

There is a device, which works the same way but in the opposite direction it’s
. There is one more called a decoder, but let’s keep it simple.

So we can now switch signals easily.

Step 5:

Computers should know how to add numbers. We know how to add with carry from school. The computer should know at least the same, but for the binary numbers.

Humans:

Computers: 0+0 = 0, 1+0=1, 1+1=0 and remember 1 (carry)

It’s called adder. This is half-adder, but we can connect them together so we can add larger number then 1. It’s made from one AND gate and one XOR gate.

Subtraction works in a very similar way. Other operations are made from these simple ones. Not that important.

Step 6:

A computer makes a sequence of commands. We need couple of things for it. First we will learn how to remember a value.

It’s called a flip-flop and what it does it that you can push zero or one inside (configure the circuit to that state) and keep it as long as you need it. Than you can read it for future use.

Step 7:

Have you seen the clock signal on the image above? All the technical specifications of mobile phones says the 1.3 gigahertz or similar thing. It refers to this clock signal. It looks a bit like cog from a cogwheel and it works in a similar way. 1 GHz clock generates 1 billion of tics per second and each tick is like a cog which pushes the calculation forward.

Step 8:

When we put multiple flip-flops next to each other, we can remember larger numbers. This is how memory and registers works. We can retrieve the information from the memory with tools we have. When I want the content of the memory location 5 I will send the signal “5” and with decoder it will be decoded just to “read” signal for the location 5. Just this one will be “opened” and I will receive the content of it to any other location I need. So we reuse wires and the signals open and close the wires so we can change the paths among the parts of the computer.

Step 9:

Now the computer looks like a pretty dumb thing, how we can control the behavior? We are missing just one device, which is made from the components we know and it is called “finite state machine”. You know it for example from the vending machine – look at simple
.

It starts with “hello, do you want a drink?”, than it switches to “money counting” than “select the drink” and then “make the drink and good bye”. Then it starts from the beginning.

The device starts in one state. It always reads a number and based on the number it changes its state to another state. The finite state machine we need switches between some simple states “read instruction, decode instruction, calculate, store result”.

Step 10:

A computer. Let’s look at one simple implementation.

We switch it on. We use one memory location as a program counter. It remembers “where we are”. It starts from zero. Finite state machine is in read state, so we open the memory location zero, read a number and decode it as an adding instruction. The state machine therefore opens the arithmetic unit and then switches back to read state, reads the operands and passes them to the arithmetic unit as well. Then it switches to the calculation what basically means that it opens the “gate” from the other side of the arithmetic unit and allows the result to flow back to memory to a location specified in the instruction (let’s say it’s location 100). Than the state machines switches back to the starting point, it increases the program counter to 1, so we look into memory location 1 for the next instruction. And so on.

The computer instructions are very simple like “read a number”, “add two numbers”, “check if the number is greater then 5”, “store number”. For programming computers we use so called “high level languages”. We can write a command like “flip the image upside-down”. This single command is then broken down to often hundreds of the simple computer instructions which are executed one by one very quickly. As mentioned before, nowadays doing about 1 billion instructions per second is nothing special for a mobile phone. But the processor do not contain other parts than the ones described above (beside some technical details). Which is incredible.