CPUThe CPU (Central Processing Unit) is the brain of the computer, and it has the most highly complex circuitry in a computer. Recall that a computer has five basic components: input, output, processor, memory, and storage. Since the CPU works closely with memory, or primary storage, referring to it for both data and instructions, we will examine both these components in this chapter. General purpose and special purpose computers will be used in some examples in this chapter. The two main components of the Central Processing Unit are its ALU (Arithmetic Logic Unit) and the CU (Control Unit). Show
ALUJust as with a human brain, the ALU is where the arithmetic operations are performed and where logical decisions are made. As its name implies, the arithmetic logic unit performs basic operations such as addition and subtraction. Higher order operations such as multiplication and division are done either by "hard-wiring," that is, done using hardware, or by following software instructions. The logic unit cannot make a decision such as, "What should I wear tomorrow?". Instead it makes a comparison and determines if the result is true or false. These comparisons are based on the traditional mathematical relations: equal (=), less than (<), greater than (>), less than or equal, greater than or equal, and not equal. Since there is no single key on a keyboard for each of the last three relations, they are entered as multiple keystrokes: <=, >=, and <>. Assume that your instructor records his/her grades in a spreadsheet, a software application that we will examine in Chapter 13, and that a "B" is a grade in the eighties. The logic unit can test your grade to see if it is >= 80 and <90. If both conditions are true, then the letter grade is a B. However if either condition was false, in the case of a 65 or a 95, then your grade would not be a B. As you can see, the logic unit can make compound decisions connected by the logical operators and or or. Although it is not usual for a mainframe computer to have multiple CPUs, most personal computers only have a single one. However with a newer personal computer, that single ALU will very likely have two or more ALUs. Whereas the ALU processes data, the Control Unit processes instructions.Control UnitThe control unit's circuitry directs the computer system to execute stored program instructions. For example a typical instruction may be to read a character from the keyboard and store the keystroke in a specific memory location. Instructions are numerically coded. Suppose that 04 is the code for reading a keystroke, and 89 is the memory address where the character is to be stored. The instruction would be 0489. If 05 is the code for outputting to the printer, then 0589 would send the character found in cell #89 to the printer. Actual instructions are more complex than this, and they are written in binary. Furthermore, each processor, or family of processors, can have different instruction sets. For example, the 0489 command may instruct a Wintel computer to read data from the keyboard and store it in memory, but on a Macintosh computer, the instruction could mean retrieve the contents of that memory cell and add it to the number in the ALU. It is important to understand that both instructions and data are stored numerically and in binary. Using the previous example, 04 is actually 0100, and 89 is 1011001. So the instruction would be 01001011001. Suppose that the keystroke was the letter A, then the actual contents of cell #89 would not be an "A", but instead its binary code, which is 01000001. This example uses the ASCII code, which is one of the most commonly used character codes for microcomputers. We now turn our attention to memory.
…of a control unit, an arithmetic logic unit (ALU), a memory unit, and input/output (I/O) controllers. The ALU performs simple addition, subtraction, multiplication, division, and logic operations, such as OR and AND. The memory stores the program’s instructions and data. The control unit fetches data and instructions from memory and… Read More…(3) control unit, and (4) arithmetic-logic unit. Any of a number of devices is used to enter data and program instructions into a computer and to gain access to the results of the processing operation. Common input devices include keyboards and optical scanners; output devices include printers and monitors. The… Read Morerelation to central processing unit
What part of the computer carries out arithmetic operations such as addition?An arithmetic-logic unit is the part of a central processing unit that carries out arithmetic and logic operations on the operands in computer instruction words. In some processors, the ALU is divided into two units: an arithmetic unit (AU) and a logic unit (LU).
What is the function of ALU in computer?The ALU performs simple addition, subtraction, multiplication, division, and logic operations, such as OR and AND. The memory stores the program's instructions and data.
How does computer is able to execute an instruction?The CPU runs instructions using a "fetch-execute" cycle: the CPU gets the first instruction in the sequence, executes it (adding two numbers or whatever), then fetches the next instruction and executes it, and so on. Some of the instructions affect the order that the CPU takes through the instruction sequence.
What are special software tools called that let you trace through a program to find run time errors?A debugger is a software tool that can help the software development process by identifying coding errors at various stages of the operating system or application development.
|