How a CPU Work

翻译自 http://www.hardwaresecrets.com/how-a-cpu-works

Introduction

Even though every microprocessor has its own internal design, all microprocessors share a same basic concept – which we will explain in this tutorial. We will take a look inside a generic CPU architecture, so you will be able to understand more about Intel and AMD products and the differences between them. The CPU (Central Processing Unit) – which is also called microprocessor or processor – is in charge of processing data. How it will process data will depend on the program. The program can be a spreadsheet, a word processor or a game: for the CPU it makes no difference, since it doesn’t understand what the program is actually doing. It just follows the orders (called commands or instructions) contained inside the program. These orders could be to add two numbers or to send a piece of data to the video card, for example. When you double click on an icon to run a program, here is what happens:

  1. The program, which is stored inside the hard disk drive, is transferred to the RAM memory. A program is a series of instructions to the CPU.
  2. The CPU, using a circuit called memory controller, loads the program data from the RAM memory.
  3. The data, now inside the CPU, is processed.
  4. What happens next will depend on the program. The CPU could continue to load and executing the program or could do something with the processed data, like displaying something on the screen.

image: http://www.hardwaresecrets.com/wp-content/uploads/cpu_012.jpg

How a CPU loads dataFigure 1: How stored data is transferred to the CPU.

In the past, the CPU controlled the data transfer between the hard disk drive and the RAM memory. Since the hard disk drive is slower than the RAM memory, this slowed down the system, since the CPU would be busy until all the data was transferred from the hard disk drive to the RAM memory. This method is called PIO, Processor I/O (or Programmed I/O). Nowadays data transfer between the hard disk drive and the RAM memory in made without using the CPU, thus making the system faster. This method is called bus mastering or DMA (Direct Memory Access). In order to simplify our drawing we didn’t put the north bridge chip between the hard disk drive and the RAM memory in Figure 1, but it is there. If you’d like to learn more about this subject, we’ve already written a tutorial on that. Processors from AMD based on sockets 754, 939 and 940 (Athlon 64, Athlon 64 X2, Athlon 64 FX, Opteron and some Sempron models) have an embedded memory controller. This means that for these processors the CPU accesses the RAM memory directly, without using the north bridge chip shown in Figure 1. To better understand the role of the chipset in a computer, we recommend you to read our tutorial Everything You Need to Know About Chipsets.

Read more at http://www.hardwaresecrets.com/how-a-cpu-works/#YLhbhtKE4AO88Aud.99

results matching ""

    No results matching ""