Basic Operating Concepts
The main function of a computer system is to run programs, which are sequences of instructions. These instructions are stored in the computer's memory.
These instructions are executed to process data that has been loaded into the computer's memory via input devices.
After processing the data, the result is either stored in memory for future use or sent to the outside world through an output port.
To execute an instruction, the processor includes not only an arithmetic logic unit and a control unit but also several registers for temporary data storage and special functions.
The special function registers include program counters (PC), instruction registers (IR), memory address registers (MAR) and memory and memory data registers (MDR).
Program Counter is one of the most important registers in the CPU.
The Program Counter oversees the execution of instructions. It keeps track of the current instruction being executed and identifies the next instruction in line.
The Instruction Register (IR) holds the instruction that is currently being executed.
The contents of the Instruction Register (IR) are accessible to the control unit, which generates timing signals to control the various processing elements involved in executing the instruction.
The two registers, MAR and MDR, are used to manage data transfer between the main memory and the processor.
The MAR holds the address in the main memory where data is to be transferred to or from.
The MDR contains the data that is to be written into or read from the specified address in the main memory.
When the processor is required to interact with devices, it is said to be servicing them. The processor can handle this in one of two ways.
One method is to use polling, and the other is to use interrupts.
Polling allows the processor to regularly check each input and output device to determine if any of them require servicing.
The interrupt method provides an external asynchronous signal that alerts the processor to pause its current instruction and execute a new routine to service the requesting device.