A CPU has three essential components: an ALU, registers, and a CU. The ALU, or arithmetic logic unit, performs mathematical calculations and logical operations. To the ALU, all the data in a computer is considered a number. An example of an ALU's mathematical operation is multiplying two numbers together. An example of a logical operation is comparing two numbers to determine which one is larger. A register is temporary storage for data. Different CPUs have different numbers of registers. While computers store most of their active data in RAM, the ALU can only directly access the registers. Thus, having more registers is an advantage.
The CU, or control unit, controls the movement of data inside the CPU. It can be thought of as the CPU's traffic cop. It determines, for example, which registers are sent to the ALU for computation.
The CU is itself controlled by the program the CPU is executing. A program is made of a series of instructions. The format of these instructions is specific to the particular model of CPU and is known as the machine language of the CPU. A single instruction either retrieves data from an address in RAM into a register, stores data from a register to an address in RAM, or sends values from two registers to the ALU to perform a computation or comparison.
The instructions themselves are stored in RAM along with the data. This means that to the CPU, an instruction is just another set of bits, another binary pattern. Having the programs stored in the same memory as data is known as the stored program concept. Because the concept was popularized in a well-known article by mathematician John von Neumann, the stored program concept was once referred to as von Neumann architecture. However, since this term gives the mistaken impression that von Neumann invented the concept, it is rarely used now.
Because binary patterns are hard for the human mind to follow, when computer scientists talk about a machine language, they do so at an elevated level of abstraction called assembly language, which is a machine language written in a human-readable form. Each assembly language instruction corresponds exactly with one machine language instruction; it's just written with words and numbers instead of a bit pattern.
When you read that a computer can perform about a billion instructions per second (as current CPUs can), keep in mind how small these instructions are. Simply retrieving two pieces of data and adding them together takes three machine language instructions. Actions that seem trivial to the user, such as opening a window in the middle of the screen to say, "Are you sure you want to quit without saving your work?" require the execution of countless instructions on the CPU. The heart of CPU operation is the fetch-execute cycle. The CPU endlessly repeats the following steps:
How does a CPU actually compute? Although from our point of view the CPU is capable of adding, multiplying, and so on, from the CPUs point of view it is not manipulating numbers, but rather, patterns of bits (on/off values) that represent numbers.
The basic bit manipulation control is called the transistor, which is a device that allows one flow of current to control another. Again using lamps as an example, imagine that you have a lamp with its own on/off switch plugged into a power socket and that socket is controlled by another switch on the wall. If the lamp switch is "on," you can turn the lamp on or off by using the switch on the wall. If the lamp switch is "off," it doesn't matter how the switch on the wall is set; the lamp will be off.
This arrangement produces what's called the "And operation": the lamp is on only if both switches—the wall switch "and" the lamp switch—are on. By wiring multiple transistors together in different combinations, more complicated logical operations can be performed. A particular way to connect a group of transistors is called a logic circuit, circuits that can be combined to form even more complicated logic circuits. As you might expect, it takes a lot of transistors to accomplish useful tasks. Simply to add two bytes representing two whole numbers together requires over 100 transistors. A modern processor contains millions of transistors.
Early computers used vacuum tubes as transistors. Now, transistors are made of silicon and metal. A modern CPU is built in layers like a very flat wedding cake. Different layers have different patterns of metal running through them. The way the layers are put together, every line of metal in one layer that crosses over a line of metal in another layer results in a transistor with the flow of power in one line controlling the flow in the other. The design of CPUs is so complicated that it takes a powerful computer to help design them.
While all that is necessary to make a CPU are the ALU, CU, and registers, most CPUs devote a large percentage of their tiny real estate to another set of components, called the cache. This is fast-access memory that is used for faster retrieval than is possible from main memory. The cache would be equivalent to a file you keep on your desk, rather than putting it back in the filing cabinet, because you think you'll use it again soon.
Cache access is faster than main memory for two reasons. First, because the cache memory is inside the CPU, the data doesn't have as far to travel as data from main memory. And second, cache memory is made from faster static RAM, not dynamic RAM.
Cache is essential to the performance of current CPUs. Retrieval from main memory is too slow relative to the CPUs' clock speed. If the CPU had to wait for every piece of data to come from RAM, it would spend most of its time idling. Because early CPUs did not have caches, the speed of early computers was limited by the speed of main memory access, not the power of CPU. This weakness was called the von Neumann bottleneck, because it was an inevitable consequence of the von Neumann (stored program) architecture.
For cache to be effective, however, the right data has to be in the cache when the CPU needs it. Because cache can only hold a fraction of the data in main memory, the CPU has rules to determine which items in RAM are to be held in cache at any given time.
These rules are based upon the principle of locality, which says that when a particular address in memory is accessed, it's likely that nearby addresses will be accessed soon. Using this principle, when an address is requested and the data is not currently in cache, the CPU retrieves the requested address and all the addresses around it in a block and puts them all in cache.
Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
Note: This article was sent to us by: Ryan Welsh at 02122011
1. Interactive shape deformation
All articles are property of their respective authors. Please read our Privacy Policy!
© 2009 ArticleInput.com.
Partners: Damenmode