Home  >  Article  >  What are the three steps in order to run a program on a computer?

What are the three steps in order to run a program on a computer?

WBOY
WBOYOriginal
2022-07-20 15:33:0017100browse

The three steps of running a program in a computer are: 1. Instruction fetching stage, fetching relevant instructions from the instruction cache and sending the instructions to the instruction register; 2. Decoding stage, sending the instructions to the instruction decoding Decoding in the device, the instruction decoder sends a control signal, and the program counter adds 1 to point to the next instruction; 3. In the execution phase, the data is loaded into the register, and the operation status is recorded. If there is a carry or overflow, it is recorded in the status register, and then The operation results are sent through the on-chip bus.

What are the three steps in order to run a program on a computer?

The operating environment of this tutorial: Windows 10 system, DELL G3 computer.

What are the three steps of running a program in a computer?

Fetching instructions, decoding, and executing

The detailed operations of each step are as follows

Instruction fetching stage:

1. Fetch the relevant instructions from the instruction cache

2. Send the instructions to the instruction register

Analysis instructions:

1. Send the instruction to the instruction decoder for decoding

2. The instruction decoder sends a control signal, and at the same time, the program counter increases by 1 and points downward. An instruction

points to the instruction:

1. Load data into register

2. ALU processes data

3. Record The operation status, if there is a carry or overflow, is recorded in the status register

4. Send the operation result through the on-chip bus

Expand knowledge

CPU pipeline design

The above process is the general operation of the instruction execution process. The above demonstration basically covers each step of the instruction execution process.

There is a problem in the instruction execution process. When instructions need to be fetched and analyzed, the controller is mainly responsible for the work. When the instructions are executed, the arithmetic unit is mainly responsible for the work. That is to say, the arithmetic unit and the controller cannot work at the same time, resulting in low comprehensive utilization of the CPU. Therefore, it is necessary to improve the instruction execution process to improve the comprehensive utilization of the CPU. The improvement method is pipeline design.

The CPU assembly line design is similar to a factory assembly line. The factory assembly line allows multiple products to be processed at the same time. At the same time, different products are in different stages of processing.

When pipeline design is not applied, computer instructions are executed serially:

What are the three steps in order to run a program on a computer?

When pipeline design is used, computer instructions are executed in parallel as shown below Executed:

What are the three steps in order to run a program on a computer?

#For more related knowledge, please visit the FAQ column!

The above is the detailed content of What are the three steps in order to run a program on a computer?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn