Computer Science Tutorial

Introduction to CPU

The most complex electronics circuitry within a computer that retrives and executes instruction from main memory is called the main processor or central processing unit. It is the brain of computer which performs many task like arithmatic logic operation, memory read/write, disk read write, handling input output etc.

It consists of three basic parts.
  1. ALU
  2. CU
  3. Registers


The register set stores immediate data used during the execution of instructions. The ALU unit performs the arithmatic and logic micro-operation for executing the instruction. The control unit acts like a superviser, which decodes the instruction and supervises the transfer of information among the registers and instructs the ALU as to which operation to perform.

Some basic terms related to CPU


What is Clock speed of CPU


It represents how many pulses cpu can generate in a second. A pulse is used to synchronize different components of a processor like ALU, CU and registers. Generaly CPU does not generate clock pulse itself, there is an external circuit found called oscillator circuit which generates a consistent number of pulses each second in the form of periodic sound wave.

Clock speed actually determines rate of instruction excution by CPU. Faster the clock, the more instruction CPU will execute each second.

Clock speed which is also known as cpu frequency is measured in Mhz or Ghz. Today all processors are atleast 1.8 Ghz. 1.8 Ghz means 1.8 billion cycles per second. Theoretically speaking it should excute 1.8 billion instructions per second but practically that never happens. There are lots of factors which affects its speed like bus speed, memory speed, speed of the disk etc. These are slower components and CPU constantly accesses these components which make cpu wait and wastes its clock cycles.

What is CPU Instruction cycle


It is the cyclic process CPU follows for executing the instruction. There are three main stages in this complete cyclic process. It starts from fetching the instruction form memory, decoding the instruction and finally excuting it. Each stage requires one cpu clock to complete. So looking at above scenario it seems like it would take at least 3 clock cycle to execute an instruction. So, how do we make cpu, which executes instruction every clock cycle. Solution to this problem is pipelining, which is explained below.

What is Instruction Pipelining


In computing, pipelining is the concept of achieving instruction parallelism in a single processor. It is basically breaking down the instruction execution cycle into a numnber of suboperation where each suboperation being executed in a separate cpu segment paralelly with all other suboperations.
Fundamental stages in pipelining are below
  1. Instruction fetch
  2. Instruction decode
  3. Calculate the effective address
  4. Fetch operands from effective address
  5. Instruction execute
  6. Write the result back into memory

These are the fundamenta stages in pipelining, but stages may vary depending upon the type of instructions.

What is Throughput


It is the number of instructions excuted by the CPU every unit of time. Pipelining increases the instruction throughput of cpu but it does not reduce the execution time of an individual instruction.

What is Vector Processor


Vector processors are specifically designed to work on vectored data. By vectored data means large array of floating point numbers. Computation on these vectored data are required in many science and engineering applications. Without these sophisticated computers many of the required computations can not be completed in reasonable amount of time. To achieve this requied level of high performance it is necessary to utilize parallel and vector processing techniques.

Lets take an example of vector processing, we take two arrays A[n] and B[n] and add them. In general purpose conventioanl compuetrs we need loop to retrive one element from each array, add them and repeating this operation 'n' number of times, because conventioanl computers does not support parallel processing. But in vector processor we need just one operation to add both the arrays, because it adds all the element of the two arrays in a parallel manner. So, of course we need extra set of cpu registers and combinational logic to achieve this. That is why vector processors are considered very complex and costly and it is not required in day to day work. Vectors processors are generally found in super computers.
BN Computer Academy
All Rights Reserved