How Computers Process Data

How Computers Process Data


Two components handle processing in a computer: the central processing unit, or CPU, and the memory. Both are located on the computer's motherboard.

The CPU

The CPU is the "brain" of the computer, the place where data is manipulated. In large computer systems, such as supercomputers and mainframes, processing tasks may be handled by multiple processing chips. (Some powerful computer systems use hundreds or even thousands of separate processing units. In the average microcomputer, the entire CPU is a single unit, called a microprocessor. Regardless of its construction, every CPU has at least two basic parts: the control unit and the arithmetic logic unit.

  1. The Control Unit

All the computer's resources are managed from the control unit, Think of the. the control unit as a traffic signal directing the flow of data through the CPU, as well as to and from other devices. The control unit is the logical hub of the computer. The CPU's instructions for carrying our commands are built into the control unit. The instructions, or instruction set, list all the operations that the CPU çen perform. Each instruction in the instruction set is expressed in microcode- a series of basic directions that tell the CPU how to execute more complex operations.

  1. The Arithmetic Logic Unit

Because all computer data is stored as numbers, much of the processing that takes place involves comparing numbers or carrying out mathematical operations. In addition to establishing ordered sequences and changing those sequences, the computer can perform two types of operations: arithmetic operations and logical operations. Arithmetic operations include addition, subtraction, multiplication, and division. Logical operations include comparisons, such as determining whether one number is equal to, greater than, or less than another number. Also, every logical operation has the opposite. For example, in addition to "equal to" there is "not equal to."  Many instructions carried on the simple moving data Many instructions carried out by the control unit involve simply moving data from one place to another- from memory to storage, from memory to the printer, and so forth. When the control unit  Performed by the Arithmetic Logic Unit counters an instruction that involves arithmetic or logic, however, it passes that scribed earlier.

The ALU includes a group of registers thigh-speed memory locations built equal to directly into the CPU that is used to hold the data currently being processed. You can think of the register as a scratchpad. The ALU will use the register to hold the data currently being used for a calculation. For example, the control unit might load two numbers from memory into the registers in the ALU. Then it might tell the ALU to divide the two numbers (an arithmetic operation) or to see whether the numbers are equal (a logical operation). The answer to this calculation will be stored in another register before being sent out of the CPU.

Machine Cycles

Each time the CPU executes an instruction, it takes a series of steps. The completed series of steps is called a machine cycle…A machine cycle itself can be broken, down into two smaller cycles: the instruction cycle and

the execution cycle, the beginning of the machine cycle (that is, during the instruction cycle), the CPU takes two

steps:

  1. Before the CPU can execute an instruction, the control unit must retrieve (or fetch) a command or data from the computer's memory. the control unit must break down (or decode) the command into instructions that correspond to those in the CPU's instruction set.

  2. Decoding, Before a command, can be executed, the Artist point, the CPU is ready to begin the execution cycle:

  3. Storing. The CPU may be required to store the results of an instruction in memory (but this condition is not always required). 

  4.  Executing, When the command is executed, the CPU carries out the instructions in order by converting them into microcode.

Although the process is complex, the computer can accomplish it at an incredible speed, translating millions of instructions every second. In fact, CPU performance is often measured in millions of instructions per second (MJPS), Newer CPUs can be measured in billions of instructions per (131PS).

Even though most microprocessors execute instructions rapidly, newer ones can perform even faster by using a process called pipelining (or pipeline processing). In pipelining, the control unit begins a new machine cycle, that is, it begins executing a new instruction--before the @rrent cycle is completed. Executions are performed in stages: 

When the first instruction completes the "fetching" stage, it moves to the "decode" stage and a new instruction is fetched. It is helpful to think of a pipeline as an assembly line, Each instruction is broken up into several parts. Once the first part of an instruction is done, it is passed to the second part. Since the first step in the line is now idle, the pipeline then ferds a new step one.

Using this technique, newer microprocessors can execute up to 20 instructions simultaneously. Modern operating systems support the running of many programs or multitasking. The CPU may be asked to perform tasks for more than one program.

To make this work, the OS and the CPU cream threads. (A thread is one instruction from a program. The CPU will execute one thread from a program at one time. Since the CPU can perform each thread quickly, the user thinks that each program is better to run at the same time. Newer processors support hyperthreading. Hyperthreading allows multiple threads to be executed at one time


  1. Memory

The CPU contains the basic instructions needed to operate the computer, but it cannot store entire programs or large sets of data permanently The CPU needs to have millions (or even trillions, in some computers) of bytes of space where it can quickly read or write programs and data while they are being used. This area is called memory, and it consists of chips either on the motherboard or on a small circuit board attached to the motherboard, This electronic memory allows the CPU to store and retrieve data quickly.

There are two types of built-in memory: permanent and nonpermanent. Some memory chips retain the data they hold, even when the computer is turned off. 

This type of permanent memory is called nonvolatile. Other chips-in facts, most of the memory in a microcomputer--lose its contents when the computer's power is shut off. This type of non-permanent memory is called volatile.