Arithmetic-Logic Unit (Alu)
The arithmetic-logic unit (ALU) is an area of the processor responsible for the rigorous processing of mathematical and logical operations required by programs.
Innocuous-looking when separated from the motherboard, the CPU simply looks like a large silicon chip with copper pins radiating from its perimeter or, as with more modular units, a plastic cartridge containing such a chip. The look of the CPU may be deceiving, however; it is made up of a few cooperating parts. One area is called an ALU. It is the ALU that helps smooth the functioning of a high--level spreadsheet and keeps the three dimensional, high--definition graphics of a space war game moving with satisfying fluidity. Even the program that stores, sorts, and prints the family recipes requires the prompt return of calculations from the ALU in order to be competitive with the shoebox of handwritten cards.
An ALU's specialty is split between basic mathematics and logic—it performs the operations of addition, subtraction, and multiplication of integers as well as evaluates logical expressions containing comparisons such as equals, is greater/less than, etc. Examples of arithmetic are as simple as "2984 + 3800" or "30 * 20" (the asterisk is used in place of the traditional multiplication sign x in programming). Logical statements might be a little less familiar, but simple questions posed by the program such as "IF A = B GOTO 2300" ask the ALU to decide if the values A and B are the same and return the answer in the form true or false to the processor. If the response in this example were true, the program would jump to line 2300. If false, the program would ignore the "GOTO" command and execute the next line of code. It must be made clear that the arithmetic logic unit is merely a functionary component of the CPU; that is, it merely accepts questions and gives answers, making no decision on what to do next.
Because the ALU does not have control over the direction of the program, the question of how it knows what to evaluate and what to leave for processing by other components of the CPU is often raised. Mathematical functions and logical expressions rarely exist by themselves in programs. Instead, they are tightly embedded in lines of code that often contain more than one function or expression or a combination of both. Another portion of the CPU, the instruction decode logic component, is charged with monitoring the program's code to determine what operations are appropriate for the ALU to perform and directs them to it accordingly. The instruction decode logic also directs the ALU's response back to the main program.
For an applied example, consider the recipe storage program mentioned earlier. At some point, it would be meaningful to have the recipes sorted alphabetically. Just one could take two index card recipes and compare their first letters to decide which one would be first, the ALU is asked to make the decision in the ordering of the electronic recipes. If it must sort recipes for apple pie, stroganoff, and beef stew, the program most likely asks a series of logical questions of the ALU: Does apple pie come before stroganoff ("A < S")? The value "TRUE" is returned, and the apple pie recipe is placed before the one for stroganoff. The process is repeated with the next recipe. Does beef stew come before apple pie ("B < A")? The ALU returns with "FALSE," so the program asks the same question of the next item already in the list: Does beef stew come before stroganoff ("B < S")? The answer sent back is "TRUE", and the program places the beef stew recipe the one for apple pie and before that of stroganoff. The only part in the ordering process that the ALU has is evaluation of the logical expressions.
This is the complete article, containing 636 words
(approx. 2 pages at 300 words per page).