| The processor is an electronic circuit that | | | | denoted by the decoder. This operation is done |
| executes computer programs. It performs it in | | | | on the operand contained along with the |
| four basic phases: | | | | instruction bits in the memory word.. The |
| 1. Fetch: In this phase, the processor collects the | | | | operation can be addition, subtraction, AND, or |
| bytes to execute from memory (which may be | | | | any mathematical or logical operation. |
| RAM or cache). Each instruction is saved in | | | | 4. Write Back: once the processor done the |
| memory as one or more bytes depending on the | | | | operation, it writes it back to the memory in the |
| processor type. The more the word +length, the | | | | place denoted by the instruction. This result may |
| more complexity and power consumption of the | | | | be fed to other instructions in the same program. |
| processor. Once the processor collects the bytes, | | | | This processes are repeated for each instruction |
| then it is ready to decode it. | | | | until the whole program is executed. recall that |
| 2. Decoding: In this phase, the processor takes | | | | the program is composed of a series of |
| the bytes read in the previous step and input | | | | instructions that are hold in memory. each time an |
| them to the decoder. The decoder activates then | | | | instruction is encountered, the above phases are |
| the line corresponding to the instruction whose | | | | repeated for each instruction. |
| bytes equal to the bytes read from the fetching | | | | Modern processors can execute these phases in |
| phase. Each instruction in the processor is mapped | | | | parallel by techniques called parallel processing. this |
| to a certain bits or bytes by the designer so that | | | | will allow for higher speed of execution but at the |
| when the processor fetches these bits or bytes, | | | | cost of the coplexity of the hardware and power |
| it can understand them. The number of bits used | | | | consumption. parrallel processing requires to |
| to represent each instruction may vary according | | | | monitor processes which are executed in parallel |
| to the processor type. Note that this number of | | | | such that they cannot alter variables at the same |
| bits may not take the whole word in the | | | | time. this is what is called synchronization. if two |
| memory. For example if the word is represented | | | | programs which are executed at the same time |
| by 8 bits, then the first four bits can be assigned | | | | access the same variable it will lead to errors in |
| to the instruction part and the last four bits can | | | | the results. this is one reason that make parallel |
| be assigned to the data which is needed for the | | | | processing more complicated. In terms of |
| instruction to execute. | | | | programming, processes are called threading, |
| 3. Executing: once the processor knows the | | | | which means that the programmer can create |
| meaning of the bits by the decoder, it goes then | | | | two blocks of instructions which are executed at |
| to the execute phase. In this phase, the | | | | the same time. |
| processor makes the necessary operation as | | | | |