Computer System Hardware Notes
Computer System Hardware
Introduction
- Computer Hardware: Physical parts/components that contribute to a computer system, can be felt and touched.
Inside a Computer Cabinet
- Motherboard:
- Main circuit board.
- Connects all computer components.
- Houses processor and RAM.
- Central Processing Unit (CPU):
- Performs calculations for processing.
- Controls all parts of the computer system.
- Memory Unit (RAM):
- Stores data temporarily to run programs.
- Storage Unit:
- Stores data and programs permanently until deletion.
- Examples: HDD, SSD.
- Graphics Processing Unit (GPU):
- Processes vast amounts of graphical data.
- Improves visual performance.
- Network Interface Card (NIC):
- Provides a dedicated, full-time connection to a network.
- Sound Cards:
- Generates and records audio.
- Enables connection of speakers and microphones.
- Fans and Heat Sinks:
- Removes heat from components to improve performance.
- Reduces hardware component temperature.
- Power Supply Unit (PSU):
- Takes electricity from an external source and powers the motherboard and individual hardware components.
Computer Architecture
- Design, arrangement, construction, or organization of different parts of a computer system.
- Describes what and how the computer does it.
- Components of a Computer System:
- Input Unit
- Processing Unit
- Arithmetic and Logic Unit (ALU)
- Control Unit (CU)
- Memory Unit (Registers)
- Memory/Storage Unit
- Output Unit
Central Processing Unit (CPU)
- The single unit is called a processor.
- Brain of the computer, controls overall operations.
- Multipurpose, programmable, clock-driven, register-based component.
- Performs Arithmetic and Logical Operations.
- Organizes and executes instructions.
- Arithmetic and Logic Unit (ALU):
- Performs arithmetic and logical operations.
- Arithmetic operations are fundamental mathematical operations.
- Logical operations are comparisons.
- After processing, data is stored or released to an output device.
- CPUs have multiple ALUs and FPUs that work together.
- Control Unit (CU):
- Controls the entire operation of the computer.
- Acts as a central nervous system.
- Determines what task is to be performed and assigns the task for components to perform.
- Memory Unit (Registers):
- Groups of high-speed memory within the CPU used during processing.
- Does not perform actual processing.
- Stores data temporarily during program execution.
- Fastest memory.
- ALU uses registers to store data, intermediary calculations, and results.
- CPU registers also hold status information, program counters, or memory addresses.
- Common Register Types (Register Array):
- Memory Address Register (MAR): Holds the address of active memory location.
- Memory Buffer Register (MBR): Holds the contents of accessed memory location.
- Program Counter Register (PCR): Holds the address of the next instruction to be executed.
- Accumulator Register (AR): Holds the data to be operated upon.
- Instruction Register (IR): Holds the current instruction being executed.
- Input/Output Register (IOR): Used to communicate with input and output devices.
How CPU Actually Works?
- The System Clock:
- Located on the motherboard to synchronize computer operations.
- Sends out a signal on a regular basis (cycle).
- Cycles per second measured in hertz (Hz).
- One megahertz (MHz) = one million ticks of the system clock.
- The Machine Cycle / Instruction Cycle:
- When the CPU processes a single piece of instruction.
- Consists of four general operations:
- Fetch
- Decode
- Execute
- Store
- Each machine cycle processes a single microcode instruction.
- Simple commands may require multiple machine cycles.
- Computers may need thousands, millions, or billions of machine cycles to complete a user command or program instruction.
- The Machine Cycle Example:
- Adding 1+2 requires at least four machine cycles:
- Step 1: Fetch number 1 from RAM, decode it, and store it in register X.
- Step 2: Fetch number 2 from RAM, decode it, and store it in register Y.
- Step 3: Fetch and decode the addition instruction, add the two numbers (in registers X and Y), and store the sum in register Z.
- Step 4: Fetch and decode the instruction to display the sum, and then output the sum (currently stored in register Z) to RAM.
- Adding 1+2 requires at least four machine cycles:
BUS System in Computer
- Electrically conducting path along which data is transmitted.
- Consists of a set of parallel conductors, wires, copper tracks, aluminum trails, etc.
- Each wire carries one bit at a time.
- Compared to a highway (pathways on which data travels).
- Function of Bus System:
- Carries information from one component to another.
- One component can interact with others by bus.
- Supplies power to various peripherals connected to it.
- Structure of Bus System:
- Data Bus
- Address Bus
- Control Bus
- Data Bus:
- Transfers data between CPU, memory, and I/O devices.
- May be 16-bit or 32-bit.
- The number of wires affects the speed at which data can travel.
- An 16 wire bus can move 16-bit at a time.
- These lines are bidirectional (data flows in both directions).
- Address Bus:
- Carries memory address for read & write operations.
- The processor uses the address bus to identify peripherals or memory locations.
- The wider the bus path, the more information can be processed at a time.
- A 32-bit address bus can address bytes of data.
- Control Bus:
- Carries control signals generated from the control unit within the CPU.
- Specifies whether data is to be read or written to the memory.
- Used to carry read/write commands, the status of I/O devices, etc.
Factors Affecting CPU Performance
- Clock Speed
- Word Length
- Cache Memory
- More RAM
- Address Bus Width
- Data Bus Width
Memory / Storage Unit
- Part of the computer system used to store data or instructions temporarily and permanently.
- Once data is stored, it remains there until replaced.
Some Terminologies
- Volatility
- Random vs Sequential Access
- Logical vs Physical Representation
- Volatile / Non-Volatile Memory:
- Volatile memory: Requires continuous power to maintain stored data (e.g., RAM).
- Non-volatile memory: Retains data even when power is lost (e.g., ROM, Hard Disks).
- Random vs Sequential Access:
- Random Access: (Direct access) Data can be retrieved directly from any location, in any order (e.g., Hard drives, USB flash drives).
- Sequential Access: Data can only be retrieved in the order it is physically stored. Slower than random access (e.g., Magnetic tape drive).
- Logical vs Physical Representation:
- Logical file representation: User's view of data storage (filename, folders).
- Physical file representation: Actual physical way the data is stored on the storage media as viewed by the computer.
- Memory / Storage Unit Function:
- Storing data and instructions for short or long periods.
- Two types of memory:
- Primary Memory or Main Memory
- Secondary Memory or Auxiliary Memory
Types of Memory: On the Basis of Usage
- Primary Memory:
- RAM
- ROM
- Cache
- Secondary Memory:
- Hard Disk
- Tape Drive
- CD, DVD
- Flash Drives
Type of Memory: On the Basis of Technology
- Semiconductor Memory: Built using semiconductor components (transistor, IC). Ex: RAM, ROM, Cache.
- Magnetic Memory: Uses magnetic property for storing data. Ex: hard disk, floppy disk.
- Optical Memory: Uses optical property to read/write operation of data. Ex: CD, DVD, Blu-Ray Disk.
Primary Memory
- Main memory or system memory.
- Used for storing data and instructions during processing.
- Expensive, faster, and used in small storage capacity.
- Example: RAM, ROM, Cache memory.
RAM (Random Access Memory)
- Read/write memory.
- Possesses random access property; CPU can access any memory location in random sequence.
- Volatile memory; stores data as long as power is on.
- When power is off, stored content is lost.
- RAM is used to store:
- Instruction waiting to be executed by CPU.
- Instruction currently being executed by CPU.
- Data waiting for processing.
- Data currently being processed.
- Output data.
- Types of RAM:
- Static RAM (SRAM)
- Dynamic RAM (DRAM)
Static RAM (SRAM)
- Stores data as long as the computer is ON.
- Faster to read/write than DRAM.
- Stores data in the form of voltage.
- Rarely used due to expensive costs and limited storage capacity.
Dynamic RAM (DRAM)
- The stored data will be lost after a few milliseconds even if the computer is in ON state.
- Cheaper but slower to read/write than SRAM.
- Stores data in the form of charge.
- A refreshing circuit is required to prevent data loss.
- Popularly used at present.
Differences between SRAM and DRAM
(This section would ideally contain a table comparing SRAM and DRAM in terms of speed, cost, storage method, etc.)
ROM (Read Only Memory)
- Can only perform read operations.
- Does not have write capabilities.
- Non-volatile memory; information stored is permanent.
- Programs in ROM include firmware, BIOS program, etc.
- Helps in booting the computer system and loading the operating system.
Difference between RAM and ROM
(This section would ideally contain a table comparing RAM and ROM based on read/write capabilities, volatility, usage, etc.)
Types of ROM
- PROM (Programmable Read Only Memory)
- EPROM (Erasable Programmable Read Only Memory)
- EEPROM (Electrically Erasable Programmable Read Only Memory)
PROM
- Programmable ROM.
- User can write data in PROM only once.
- Special equipment called ROM programmer or ROM burner is available for storing data in PROM.
EPROM
- Erasable PROM.
- Data stored in EPROM can be erased by exposing it to ultraviolet light.
- Used to store programs that are permanent but need frequent updating.
- Far more economical than PROM as it can be reused.
EEPROM
- Electrically erasable PROM.
- Can be erased and reprogrammed electrically.
- Either a single byte or the entire chip can be erased in one operation.
- It has a limit on the number of times for which it can be reprogrammed.
Flash ROM (Special type of EEPROM)
- Used in small portable computers.
- Can be inserted into slots connected to the motherboard.
- Non-volatile.
- Can be overwritten.
- Now standard on most computers today.
Cache Memory
- A special, high-speed, and expensive semiconductor memory placed between RAM and CPU.
- Used so the CPU doesn't have to wait for data to be delivered.
- Most frequently used instructions are kept in cache memory.
- Allows CPU to run faster because it doesn’t have to take time to swap instructions in and out of RAM.
- Levels of Cache Memory:
- L1 Level
- L2 Level
- L3 Level
L1 Level Cache
- Smallest and fastest.
- Embedded directly into the CPU; operates at the same speed as the CPU.
- Divided into two parts:
- L1i: Stores instructions
- L1d: Stores data
- Size ranges from 2KB to 64KB.
L2 Level Cache
- Larger in size and slightly slower in speed compared to L1 cache.
- Located closer to the CPU than the main memory.
- Feeds data and instructions to L1 cache.
- Size ranges from 256KB to 512KB.
L3 Level Cache
- Also known as Last Level Cache (LLC).
- Larger than both L1 and L2 caches but is slower.
- Located outside of the CPU.
- Plays an important role in data sharing and communications.
- Size ranges from 1MB to 8MB.
Roles of Levels of Cache Memory
- Each level plays a crucial role in improving the performance of a computer system.
- By storing frequently accessed data and instructions, these caches help to speed up data access times and reduce the workload on the CPU.
Secondary Memory
- Additional or auxiliary memory.
- Non-volatile; used to store huge amounts of data.
- Usually cheaper and slower.
- No direct access to CPU; requires primary memory for operation.
- Example: hard disk, SSD, pen drive, etc.
Differences between Primary and Secondary Memory
Magnetic Hard Disk Drives (HDD)
- Consists of a rotating magnetic surface (platter).
- The mechanical arm (head) that moves over the platter is used to read from and write to the disk.
- The platter keeps spinning at high speed while the head of the arm moves across its surface.
- Data is stored in platters divided into tracks and sectors.