17-Dec-2006, 09:15 AM
|
#1 (permalink)
|
|
Administrator
Posts: 18,703
Join Date: Jan 2006
Rep Power: 10
|
Processors and instructions
When programs run, their instructions are stored in memory. An instruction execution cycle starts when the processor reads the next instruction from memory. The memory receives the read command over the bus and then one or more clock cycles later returns the requested instruction back across the bus to the processor. The processor decodes the instruction and decides what has to be done to carry it out. If the instruction requires an operand from memory, the processor calculates the address of the operand and commands the memory to fetch the operand. The processor completes gathering the necessary data after some number of clock cycles, computes the result, and if necessary stores it back to memory, disk, or the display.
The length of each instruction execution cycle determines the performance of the computer. If a computer running at a clock speed of 4 GHz can complete an instruction every clock cycle (including reading the instruction and data, computing the result, and storing back to memory), it will execute 4 billion instructions per second. If the average instruction takes two clock cycles, it will execute 2 billion instructions per second, and no more. Each instruction operates on one or more pieces of information, the operands of the instruction. An instruction might add or compare two numbers or might search a set of numbers for a specific value.
Executing instructions is the work the processor does. The tasks the processor carries out — tracking actions you take with the keyboard, joystick, or mouse; rendering and presenting the graphics on the display; moving information from disk to memory and back; communicating with your network; running your desktop accessories; or keeping the current print job going — each require some number of instructions to complete. The number of instructions required divided by the number of instructions per second determines how long each task takes.
The actual number of instructions the processor executes per second is determined by a lot of factors, including:- How big the instruction is in memory, which in turn determines how many clock cycles it takes for the memory to deliver the instructionto the processor. Not all instructions are the same size.
- How many operands the instruction has, and where they are located.
- How long it takes the memory or I/O channel (and therefore the disk) to deliver those operands to the processor.
- How long the processor actually takes to manipulate the operands and complete the instruction.
- How long it takes to put the result where it belongs.
Adding the time each of a program’s instructions takes then tells us how long the program takes to run, which is a measure of performance.

|
|
|