CPU? The CPU is short for the Central Processing Unit. It’s the brain of the computer system. It is the main part of the computer where instructions are processed. I ts also known as the microprocessor The central processing unit includes the main memory. The CPU is located on the motherboard of the system unit Now a day’s most computers have more than one CPU to provide better speed for example the 6502 which was used in the Apple 2 and the Commodore 64
More on CPUs CPUs are measured in gigahertz ( several billion times per second) In modern CPUs a wire known as a clock which turns on and off at a steady rate to make sure everything is in sync, the clock may turn on and off twice a second. That speed allows the CPU to do complicated things quickly
Microprocessor A multipurpose clock driven register based, digital integrated circuit that accepts binary data as input, processes it according to the instructions stored I memory and provides results as output A digital device on a chip that can fetch instructions from memory, decode and execute them, and give results
What do CPUs do? The main function of a computer processor is to execute instructions and produce an output. CPUs Fetch, Decode, and Execute asthe fundamental functions of the computer. Fetch: CPUs get the instruction. That means binary numbers that are passed from RAM to CPU Decode: When the instruction is entered into the CPU, it needs to decode the instructions. with the help of ALU(Arithmetic Logic Unit), the process of decoding begins. Execute: After the decode step the instructions are ready to execute. Store: After the execute step the instructions are ready to store in the memory.
Types of CPUs Single Core CPU: The oldest type of computer CPU is a single-core CPU. These CPUs were used in the 1970s. these CPUs only have a single core that performs different operations. This means that the single-core CPU can only process one operation at a single time. single-core CPU CPU is not suitable for multitasking . Dual-Core CPU: Dual-Core CPUs contain a single Integrated Circuit with two cores. Each core has its cache and controller. These controllers and cache work as a single unit. dual-core CPUs can work faster than single-core processors. Quad-Core CPU: Quad-Core CPUs contain two dual-core processors present within a single integrated circuit (IC) or chip. A quad-core processor contains a chip with four independent cores. These cores read and execute various instructions provided by the CPU. Quad Core CPU increases the overall speed of programs. Without even boosting the overall clock speed it results in higher performance.
Components Arithmetic Logic Unit Control Unit Registers Cache memory Buses
Control Unit (CU) The CU is considered the manager of the CPU It receives instructions from the RAM and breaks them down into specific commands for other components The CU’s job decode instructions within a computer plan the reading and writing of data control the order in which instructions are executed control the operations performed by the ALU Components of the Control unit Instruction Register - stores the instruction while its being executed Instruction decoder - decodes (translates to binary form) Timing and control logic - generates the signals to execute it
Arithmetic Logic Unit The ALU is that part in the CPU where arithmetic and logic operations are carried out in other words all mathematical calculations. The result of the calculations are sent to the main memory. The ALU is capable of performing : Addition, Subtraction, Multiplication, Division (AU) Greater Than (>), Smaller Than (<)’ Equal (=),Greater Than or Equal To (>=), Smaller Than or Equal To (<=), Not Equal (<>) (AU) AND, OR, NOT( Logic unit) Within the ALU we will find the register known as the Accumulator which stores the result of the current calculation.
ALU diagram and explanation Suppose we want to add two numbers 15 and 45. The first number 25 will be store in the accumulator register The second number 45 will be stored in the Data register Control unit will send a command to add these 2 numbers through control input The two numbers will be added by ALU or AU rather The output will be stored in accumulator Final result, 60 will be sent to main memory
Program Counter The program counter is sometimes known as the instruction pointer. The PC indicates where the computer is in its instruction set. If the instruction set has 5 steps the PC will point to which step the computer has arrived. Depending on the device the PC could hold the address of the instruction being executed the address of the next instruction to be executed The program counter is automatically incremented (increased by 1) after each step (instruction cycle).
Registers Small high speed temporary storage inside the CPU This is temporary memory used to store data or instructions during processing which is later passed on to the main memory The instruction register (IR) is also found within the control unit The IR is used to store a copy of the current instruction being performed This instruction is stored in the form of operator and operand
Types of registers Instruction Register - is a16-bit register that stores the current instruction code that has been fetched from the main memory. The control unit takes this instruction from the register, decodes what operation it is, and executes it accordingly. Accumulator Register - is used to store the result produced by the CPU after carrying out arithmetic or logical operations. Any final output data generated by the system is stored here. Data Register - a 16 bit register it used to temporarily store the operands (variables) that need to be operated on by the processor. It acts as a temporary holding area for the data that being transmitted to or received from the peripheral devices like the printers or keyboards. Program Counter Register - holds the memory address of a next instruction that needs to be fetched and then executed after the current instruction completes. Its role is to maintain the proper sequence of the path for the executing different program instructions one by one Memory Address Register - a 12-bit register that stores the specific address location in the memory where a particular instruction or data is residing. The CPU uses this address to fetch or store instructions/data from/to the memory
CPU Buses All data traffic with the CPU takes place across the computer’s bus A computer bus is a set of parallel electrical tracks connecting components within a computer / a group of parallel wires used to carry data or information from one part of a computer to another The CPU is connected with all the devices through buses Buses inside the CPU are known as internal buses The width of the data bus determines the word length The width of the address bus determines how many addresses the computer can send at a time
Types of buses Address bus - It is concerned with passing an address one way, from the CPU to RAM. The sole purpose of an address bus is to identify the address of the location in cache or main memory that is to be read from or written to. Each location in memory will have its own unique address, this is known as addressability. Data bus - transfers data between a computer's memory and its CPU, which operates as the device's “engine“. Bus controllers manage component information interchange speed. CPU data always travels faster than other component data. Data carried on a data bus might be parallel or serial. Control Bus - manages the communication between the computer's CPU and its other components. It specializes in transferring control signals that coordinate and regulate the hardware's actions. The signals ensure operations are carried out in the correct sequence and at the right time. Extension of these 3 buses is also available outside the CPU to communicate with all connected components of a computer(External buses)
Cache Memory A high speed small amount of memory inside the microprocessor Its also known as CPU memory because one portion of cache memory is integrated on the CPU The CPU quickly accesses this memory as compared to RAM meaning cache is faster than main memory but its expensive It stores data or information that is frequently required by the CPU It keeps an active portion of main memory
Computer programs A set of instructions written by a programmer that tells a computer what to do e.g. using a word processor or a web browser, Performing math operations on a computer and clicking and selecting items with a mouse or touch pad is also a program
Terminologies Source Code: It is nothing but code written in High-level language that humans easily understand. Machine code: It is binary code that is easy to understand by computers or machines. Compiler: It is used to translate the source code into machine code all at once. Interpreter: It is used to execute the source code line by line converting it into machine code. Algorithm: It is nothing but a set of instructions to solve a problem.
Storing computer programs Permanent Storage: Programs are stored permanently on storage devices like HDD , or SSD . Temporary Storage: When a program is running on a CPU, its data is stored in RAM from HDD or SDD. Temporary because RAM is volatile, it loses all data when the power is turned off.
Modes of computer Programs Interactive Mode I n this mode, a computer programmer issued a statement and gets an output at a time . This is useful to write and test only one statement at a time. The output of the code in the interactive mode is influenced by the last command we give. Interactive mode is very convenient for writing very short lines of code . The disadvantage of interactive mode is that it is not suitable for large programs. The interactive mode doesn’t save the statements. Once we make a program it is for that time itself, we cannot use it in the future. In order to use it in the future, we need to retype all the statements.
Batch Mode In this mode of program development programmers develop groups or batches of instructions in a single unit and it must be saved with file names with respective programming extensions . Batch processing is a process that is used in many industries to improve efficiency . Batch processing is the execution of a large program or series of programs on large amount of data without any manual intervention . Batch mode programming are commonly used in business and scientific applications where a large number of instructions need to be processed in a specific order. Once we save the instructions on some file name then we can open and access that file name any time in our project.
Applications of Computer Program Communication: Software is created using a set of programs to make communication easy. This software may include Gmail, WhatsApp, etc. Entertainment: Programs are designed for interactive entertainment and gaming experiences. These may also include software related to media players. Web technology: Computer programs play an important role to build websites as different programs are formed and then linked together to make a website. Education: Computer programs are used in the field of education as it helps to create software to conduct online classes and online tests.
Advantages of a Cpu Versatility : CPU can able to handle a complex task, from basic calculation to managing the operating system. Performance : Modern CPU are vary fast and able to perform billions of calculation per second. Multi-core : CPU have multiple core and able to handle multiple task simultaneously. Compatibility : CPUs are designed to be compatible with a wide range of software, this help to run different applications by using single CPU.
Demerits of a CPU Overheating : CPU generate a lot of heat while performing complex task. This requires effective cooling solutions, such as fans or liquid cooling systems. Power Consumption : High-performance CPUs can consume a vary high amount of power, which cause to generate higher electricity bills and the need for a robust power supply. Cost : Best performance CPU can be expensive. Which can be a barrier for some users or applications that need high computing power. Limited Parallel Processing : While multi-core CPUs can handle multiple tasks at once, they are still not as efficient at parallel processing as specialized hardware like GPUs ( Graphics Processing Units ), which are designed for handling many tasks simultaneously.
Conclusion The CPU is the brain of a computer. It carries all the instructions from programs, handling everything from simple calculations to complex tasks. Without the CPU, the computer wouldn’t be able to run programs or perform any actions. Without UPU computer like a dumb maniche . So it is vary important for the overall functioning of a computer.