The Computer System Hardware
Learn inside of a computer
Introduction
A computer is a machine with different components interacting with each other to complete a task. A Computer consists of three main components Input/Output (I/O) Unit, Central Processing Unit (CPU) and Memory Unit (MU).
Central Processing Unit
Central Processing Unit (CPU) referred to as the processer is also called the brain of the computer. The CPU performs arithmetic, logic, and Input/Output operations as specified by the instructions in the program. It consists of the Arithmetic Logic Unit (ALU), Control Unit (CU), and Memory or Storage Unit. The control unit regulates the operation of the computer while the Arithmetic Logic Unit is responsible to perform operations like addition, subtraction, or some logical operation. Memory is used to store the data and logics during processing.
Function of CPU
- To control the use of main storage to store data and instruction.
- To control the sequence of operations.
- To give commands to all parts of the computer system.
- To interpret program instruction and process data
CPU consists of Arithmetic Logic Unit (ALU) and Control Unit (CU). In addition, CPU also has a set of registers which are temporary storage areas for holding data, and instructions
Arithmetic Logic Unit
The Arithmetic Logic Unit is a part of CPU that perfoms integer arithmetic and bitwise logic operations. ALU consist of tow units - arithmetic and logic unit. Arithmetic unit performs arithmetic operations like addition, subtraction, multiplication and division. Logic unit is responsible for performing logical operations like comparing, matching and merging of data. The input to the ALU is called operands. The control unit tells the ALU what operation to performs which is known as opcode. Alu performs arithmetic and logic operations, and uses registers to hold the data that is being processed.
Registers
Registers are temporary storage areas for instructions or data. They are not a part of memory; rather they are special additional storage locations that offer the advantage of speed. Registers are often referred to as the CPU’s working memory. They work under the direction of the control unit to store data, instructions, addresses and intermediate results of processing. The data and instructions that require processing must be brought in the registers of CPU before they can be processed. For example, if two numbers are to be added, both numbers are brought in the registers, added and the result is also placed in a register. The size of a register may be 8, 16, 32 or 64 bits. For example, a 32–bit CPU is one in which each register is 32 bits wide, and its CPU can manipulate 32 bits of data at a time. Nowadays, PCs have 32–bit or 64–bit registers. Registers are used for different purposes, with each register serving a specific purpose.
- Accumulator (ACC) stores the result of arithmetic and logic operations.
- Instruction Register (IR) contains the current instruction most recently fetched.
- Program Counter (PC) contains the address of next instruction to be processed.
- Memory Address Register (MAR) contains the address of next location in the memory to be accessed.
- Memory Buffer Register (MBR) temporarily stores data from memory or the data to be sent to memory.
- Data Register (DR) stores the operands and any other data.
Control Unit
The Control Unit controls the operation of all parts of the computer and doesnot perform any actual processing og data. CU is responsible for controlling the transfer of data and instructions among other units of a computer.
Memory or Storage Unit
Computer memory is used to store data, information, programs, and its instruction either temporarily or permanently. The memory unit consists of cache memory, primary memory and secondary memory. Primary memory or main memory of the computer is used to store the data and instructions during execution of the instructions. Secondary memory is non-volatile and is used for permanent storage of data and programs. A program or data that has to be executed is brought into the RAM from the secondary memory.
Cache Memory
The data and instructions that are required during the processing of data has to be accessed from RAM and are stored in the registers. The time required to move the data from RAM to CPU register affect the processing speed of the computer. Therefore, a high-speed memory is placed in between RAM and CPU which is called Cache memory. Cache memory is a storage buffer that stores frequently used data and instructions temporarily and makes them available to CPU at a fast rate. The speed of CPU is extremely high compared to the access time of main memory decreasing the performance of CPU. To overcome this mismatch in operating speed, a small memory chip (Cache memory) is attached between CPU and main memory. During processing, CPU first checks cache for the required data. If data is not found in cache, then it looks in the RAM for data. CPU can access the cache memory without having to use the motherboard’s system bus. These memories are very expensive and hence its size is normally kept small.
Primary Memory
Primary memory or main memory of the computer is used to store the data and instructions during execution of the instructions. Primary storage, or internal memory, is computer memory that is accessible to the central processing unit of a computer without the use of computer's input/output channels. The computer can manipulate only data that is in main memory. Therefore, every program you execute and every file you access must be copied from a storage device into main memory.
Types of main memory
- Random Access Memory (RAM)
- Read Only Memory (ROM)
RAM provides temporary storage for data and instructions. RAM stores data and instructions during the execution of instructions. It is a volatile memory i.e., the information stored in RAM gets erased when the computer is turned off. The data and instructions that require processing are brought into the RAM from the storage devices. Any intermediate results generated during the processing of program are also stored in RAM. RAM is also called read/write memory where any data or instructions can be read or write in random way.
ROM is non-volatile memory that is used for storing standard processing programs that permanently reside in the computer and it can retain the stored information even when the power is off. The ROM memory chip stores the Basic Input Output System (BIOS). BIOS provides the processor with the information required to boot the system. The sequences of instructions are stored in ROM chips often by chip manufacturing company which is called firmware. It is a read only memory and data stored in ROM cannot be modified.
Secondary Memory
Primary memory has limited storage capacity, so a computer requires an auxiliary or secondary memory. In comparison to the primary memory, the secondary memory stores much larger amounts of data and information (for example, an entire software program) for extended periods of time. The secondary memory is also called the storage device of computer. These are the slowest and cheapest form of memory. The data and instructions stored in secondary memory must be fetched into RAM before processing is done by CPU. Common secondary storage devices are the hard disk, magnetic disk, and floppy disks.
Instruction Format
An instruction is an order given to computer processor to perform an operation. It is an elementary operation that the processor can accomplish. A computer program is a set of instructions that describe the steps to be performed for carrying out a computational task. The program and the data, on which the program operates, are stored in main memory, waiting to be processed by the processor. This is also called the stored program concept. There are different types of instructions such as Memory access or transfer of data between registers, Arithmetic operations like addition and subtraction, logic operations such as AND, OR and NOT and so on. A CPU performance is measured by the number of instructions it executes in a second, i.e., MIPS (million instructions per second), or BIPS (billion instructions per second).
An instruction is divided into groups called fields. The common fields of an instruction are — Operation code and Operand code. The operation code represents action that the processor must execute. The operand code defines the parameters of the action and depends on the operation. It specifies the locations of the data or the operand on which the operation is to be performed. It can be data or a memory address.
E.g.: ADD B // Add the contents of register B to the content of the accumulator.
Instruction Set
An instruction set is a group of commands for the processor. A processor has a set of instructions that it understands which includes all the operations that a processor can accomplish. The instructions in the instruction set are in language that a processor understands which is known as machine language. All programs written in a high-level language are compiled and translated into machine code before execution. All programs have to communicate with the processor using these instructions. An instruction in the instruction set involves a series of logical operations that are performed to complete each task. Some of the examples of instruction set are as below.
LOAD R1, 100 - Load the content of memory address 100 to register R1.
Load R1, R2 - Load the content of register R2 to register R1
Two processors are different if they have different instruction sets. A program run on one computer may not run on another computer having a different processor. Two processors are compatible if the same machine level program can run on both the processors
Instruction Cycle
The instruction cycle is the basic operational process of a computer system. It is the process by which a computer retrieves a program instruction from its memory, determines what actions the instruction describes, and then carries out those actions. This cycle is repeated continuously by a computer's central processing unit (CPU), from boot-up until the computer has shut down.
A instruction cycle involves four steps:
- Fetching: The processor fetches the instruction from the memory. The fetched instruction is placed in the Instruction Register. Program Counter holds the address of next instruction to be fetched and is incremented after each fetch.
- Decoding: The instruction that is fetched is broken down into parts or decoded. The instruction is translated into commands so that they correspond to those in the CPU’s instruction set. The instruction set architecture of the CPU defines the way in which an instruction is decoded.
- Executing: The decoded instruction or the command is executed. CPU performs the operation implied by the program instruction. For example, if it is an ADD instruction, addition is performed.
- Storing: CPU writes back the results of execution, to the computer’s memory.
Micro-Processor
A microprocessor is the controlling unit of a computer made up of a small chip capable of operations and communication purposes. This is also known as CPU. A processor’s instruction set is a determining factor in its architecture. Based on the instruction set, microprocessors are classified as—Reduced Instruction Set Computer (RISC), and Complex Instruction Set Computer (CISC).
Reduced Instruction Set Computer (RISC)
It is designed to reduce the execution time by simplifying the instruction set. RISC has simple, basic, and reduced set of instructions, which help in composing more complex instructions. Here, each instruction is meant to achieve very small tasks. It requires fewer transistors, which results in the reduced manufacturing cost of processor. The instruction size is fixed (32 bits). Therefore, the processor does not need to spend time in finding out where each instruction begins and ends. Moreover, the instructions are executed in just one clock cycle, which speeds up the program execution compared to CISC processors. RISC processors can handle multiple instructions simultaneously by processing them in parallel. As soon as it completes one stage of the cycle, it proceeds with the second stage. It aims to reduce the cycles per instruction at the cost of the number of instructions per program. Apple Mac G3 and PowerPC are based on RISC.
Characteristic of RISC
- Simpler instruction, hence simple instruction decoding.
- Instruction comes undersize of one word.
- Instruction takes a single clock cycle to get executed.
- More number of general-purpose registers.
- Simple Addressing Modes.
- Less Data types.
- Pipeline can be achieved.
Example – Adding two 8-bit number:
- CISC approach: There will be a single command or instruction for this like ADD which will perform the task.
- RISC approach: Here programmer will write the first load command to load data in registers then it will use a suitable operator and then it will store the result in the desired location.
So, add operation is divided into parts i.e., load, operate, store due to which RISC programs are longer and require more memory to get stored but require fewer transistors due to less complex command.
S.N. | RISC | CISC |
---|---|---|
1 | It utilizes simple, small, and highly optimized set of instructions. | It utilizes complex, large and specialized set of instructions. |
2 | It has fixed sized instructions with few addressing modes | In CISC, the instructions have variable formats with several complex addressing modes. |
3 | It executes an instruction in one clock cycle. | It requires multiple clock cycles to execute an instruction. |
4 | It is more machine-oriented and has longer program length. | It is programmer-oriented, and the program length is short. |
5 | RISC has more registers and requires more amount of RAM. | CISC has fewer registers and requires less amount of RAM. |
6 | It is mostly used in hardwired control unit such as mobile phones and tablets. | It is mostly used in microprogrammed control unit such as desktop computers and laptops. |
Interconnecting the Units of a Computer
CPU sends data, instruction and information to the components inside the computer as well as to the peripherals and devices attached to it. The components are connected to each other through a bus. Bus is a set of electronic signal pathways that allows information and signals to travel between components inside or outside of a computer. It is a set of wires used for interconnection, where each wire can carry one bit of data. A computer bus can be divided into two types—Internal Bus and External Bus.
Internal Bus
The Internal Bus connects components inside the motherboard like, CPU and system memory. It is also called the System Bus. Three types of system bus are described as below:
- Data Bus It transfers data between the CPU and memory. The bus width of a data bus affects the speed of computer. The size of data bus defines the size of the processor. A processor can be 8, 16, 32 or 64-bit processor. An 8–bit processor has 8 wire data bus to carry 1 byte of data. In a 16–bit processor, 16–wire bus can carry 16 bits of data.
- Address Bus It connects CPU and RAM with set of wires similar to data bus. Address bus carries memory addresses for read and write operations. The width of address bus determines the maximum number of memory locations the computer can address. Currently, Pentium Pro, II, III, IV have 36–bit address bus that can address 236 bytes or 64 GB of memory.
- Control Bus One of the main objectives of a bus is to minimize the lines that are needed for communication. An individual bus permits communication between devices using one data channel. It transmits control signals such as memory read write signals and status signals. Control Bus specifies whether data is to be read or written to the memory, etc.
External Bus
The External Bus connects different external devices, peripherals, expansion slots, I/O ports, and drive connections to the rest of computer. It allows for the expansion of computer’s capabilities. It is generally slower than the system bus. It is also referred to as the Expansion Bus.
An external bus comprises of three kinds of buses — data bus, address bus and control bus.
Inside a Computer Cabinet
The components inside a computer cabinet include the power supply, motherboard, memory chips, expansion slots, ports and interface, processor, cables and storage devices.
Motherboard
A motherboard is a large Printed Circuit Board (PCB) inside a computer that connects different parts of a computer together. Many chips, connectors and other electronics mounted on it. The RAM, hard drive, disk drives and optical drives are all plugged into interfaces on the motherboard. The motherboard contains the processor, memory chips, interfaces and sockets, etc. Other than bridging internal components, the motherboard ports also allow connection of external devices to the computer. Such external devices would include the monitor, speakers, headphones, microphone, keyboard, mouse, modem and other USB devices.
a) Basic Input Output System (BIOS)
It is a basic software stored on the memory chip on the motherboard which is used as an interface between the operating system and the motherboard. BIOS contain the instructions for the starting up of the computer. The BIOS runs when the computer is switched on. It checks whether the operating system is present on the hard drive. The BIOS is a small program that controls the computer from the time it powers on until the time the operating system takes over. BIOS invokes the bootstrap loader to load the operating system into memory.
b) Complementary Metal-Oxide Semiconductor (CMOS)
CMOS is a small amount of memory on a computer motherboard that stores the Basic Input/Output System (BIOS) settings. When the computer is turned off, the power supply stops providing electricity to the motherboard. When the computer is turned on again, the system still displays the correct clock time. This is because the CMOS chip saves some system information, such as time, system date and essential system settings. CMOS is kept powered by a button battery located on the motherboard.
A computer's BIOS will initialize and control components like the floppy and hard drive controllers and the computer's hardware clock, but the specific parameters for startup and initializing components are stored in the CMOS.
Ports and Interfaces
Motherboard has a certain number of I/O sockets that are connected to the ports and interfaces found on the rear side of a computer. We can connect external devices to the ports and interfaces, which get connected to the computer’s motherboard. Some of the ports are as below:
- Serial Port— To connect old peripherals.
- Parallel Port— To connect old printers.
- USB Ports— To connect newer peripherals like cameras, scanners, and printers to the computer
- Fire wire – To connect video cameras and external hard drives.
- RJ45 connector (LAN or Ethernet port) -- To connect the computer to a network. It corresponds to a network card integrated into the motherboard.
- A VGA (video graphics array) connector – To connect devices that has graphic cards. It is used for video output.
- Audio plugs – To connect sound speakers and the microphone. This connector interfaces with the built-in sound card.
- PS/2 port -- To connect mouse and keyboard into PC.
- SCSI port -- To connect the hard disk drives and network connectors.
Expansion Slots
The expansion slots are located on the motherboard. The expansion cards are inserted in the expansion slots. These cards give the computer new features or increased performance. There are several types of slots:
- ISA (Industry Standard Architecture) slot—To connect modem and input devices.
- PCI (Peripheral Component Interconnect) slot—To connect audio, video and graphics.
- They are much faster than ISA cards.
- AGP (Accelerated Graphic Port) slot—A fast port for a graphics card.
- PCI (Peripheral Component Interconnect) Express slot—Faster bus architecture than
- AGP and PCI buses.
- PC Card—It is used in laptop computers. It includes Wi-Fi card, network card and external modem.
Ribbon Cables
Ribbon cables are flat, insulated and consist of several tiny wires molded together that carry data to different components on the motherboard. There is a wire for each bit of the word or byte and additional wires to coordinate the activity of moving information. They also connect the floppy drives, disk drives and CD-ROM drives to the connectors in the motherboard. Nowadays, Serial Advanced Technology Attachment (SATA) cables have replaced the ribbon cables to connect the drives to the motherboard.
Memory Chips
The RAM consists of chips on a small circuit board. Two types of memory chips—Single In-line Memory Module (SIMM) and Dual In-line Memory Module (DIMM) are used in desktop computers. The CPU can retrieve information from DIMM chip at 64 bits compared to 32 bits or 16 bits transfer with SIMM chips.
Storage Devices
Different storage devices are present in the motherboard which are inserted in their respective drives. High-storage devices like hard disk, floppy disk and CDs are inserted into the hard disk drive, floppy drive, and CD drive, respectively. These storage devices can store large amounts of data, permanently.
Processor
The processor or the CPU is the main component of the computer which is responsible for controlling devices attached with the computer. Processors are of different types depending upon factors like speed, performance, reliability, and motherboard support. Pentium Pro, Pentium 2 and Pentium 4 are some of the processors.