Introduction to Computers, Hardware Architecture, and Programming Concepts

Fundamentals of Computing and Software Development

  • General Purpose of Computers:

    • Computers are versatile, general-purpose machines designed to perform any specific task defined by the instructions within their operating programs.
    • Educational Applications: Writing academic papers, conducting research, communicating via email, and taking online courses.
    • Workplace Applications: Analyzing data, creating business presentations, executing financial transactions, controlling industrial machinery, and facilitating professional communication.
    • Home Applications: Managing personal finances, shopping online, playing video games, and staying connected with others.
  • Ubiquitous Computerized Devices:

    • Cellular phones
    • iPods and digital audio players
    • BlackBerry devices and mobile smartphones
    • Global Positioning System (GPS) car navigation systems
  • Definitions of Software and Developers:

    • Program: A sequence of detailed instructions that a computer follows step-by-step to execute a designated task. Standard examples include word processors (e.g., Microsoft Word) and photo editors (e.g., Adobe Photoshop).
    • Software: The universal term used to describe computer programs.
    • Programmers / Software Developers: Trained professionals who possess the technical skills required to design, write, test, and maintain software programs.

Computer Hardware Architecture

  • Hardware Definition:

    • Hardware encompasses all physical, tangible electronic and mechanical components that constitute a functional computer system.
  • Five Major Hardware Components:

    • Central Processing Unit (CPU):
      • The core component that executes software instructions. A computer cannot operate without a CPU.
      • Execution / Running: Terms describing the process of the CPU executing the operational commands specified by a software program.
    • Main Memory:
      • Acts as the computer's active work area, holding both the software program currently executing and the active data required by that program.
      • Commonly known as Random-Access Memory (RAM).
      • Offers high-speed data access for the CPU.
      • It is volatile memory, meaning its contents are temporary and are completely erased when the computer is turned off.
    • Secondary Storage Devices:
      • Non-volatile memory designed to hold data and programs securely for extended periods, even when the computer is powered down.
      • Disk Drives: Magnetically encode data onto a internal circular disk. External disk drives can be attached to create system backups.
      • Floppy Drives: Write data onto small magnetic floppy disks. They possess low storage capacity, operate at slow speeds, and are generally unreliable compared to modern options.
      • USB Drives: Small portable devices that plug directly into a computer's Universal Serial Bus (USB) port. They contain no moving magnetic disks, relying instead on solid-state flash memory. Also known as memory sticks or flash drives, they are inexpensive, small, and highly reliable.
      • Optical Devices: Use high-precision laser beams to encode data as microscopic pits onto the reflective surface of CDs or DVDs. They feature large storage capacities and serve as reliable backup media.
    • Input Devices:
      • Input: Any raw data or information gathered by the computer from people or external sensors.
      • An input device is the physical hardware that collects and transmits this incoming data.
      • Examples: Keyboards, computer mice, digital document scanners, microphones, and digital cameras.
    • Output Devices:
      • Output: Any processed data or results produced by the computer for human users or external equipment.
      • An output device is the hardware responsible for formatting, presenting, or displaying output.
      • Examples: Display monitors and paper printers.

Historical and Modern Processing Hardware

  • ENIAC (Electronic Numerical Integrator and Computer):

    • Built in the year 19451945, ENIAC was the world's first programmable electronic computer.
    • It was specifically developed for the United States Army to calculate artillery ballistic trajectory tables.
    • Physical Dimensions: The CPU stood 8 feet8\,\text{feet} high, was 100 feet100\,\text{feet} long, and weighed approximately 30 tons30\,\text{tons}.
  • Modern Microprocessors:

    • Modern central processing units are built on microscopic integrated circuits known as microprocessors.
    • They are exponentially smaller in physical size while providing vastly superior processing capabilities compared to early room-sized systems.

Binary Representation and Data Storage

  • Fundamental Storage Units (Bits and Bytes):

    • All data stored in a computer system is converted into binary sequences composed exclusively of the digits 00 and 11
    • A computer's primary memory is divided into basic storage locations called bytes.
    • Each byte is further subdivided into 88 smaller, discrete electronic storage units called bits (binary digits).
    • Bits act as tiny electronic switches that hold either a positive electrical charge (representing an "on" switch or the binary digit 11) or a negative electrical charge (representing an "off" switch or the binary digit 00).
  • Numeric Representation in Binary:

    • Unsigned integer values are stored using positional binary notation based on powers of 22 (2n2^n), evaluated from right to left starting at index 00:
      • Bit 00 (far right): 20=12^0 = 1
      • Bit 11: 21=22^1 = 2
      • Bit 22: 22=42^2 = 4
      • Bit 33: 23=82^3 = 8
      • Bit 44: 24=162^4 = 16
      • Bit 55: 25=322^5 = 32
      • Bit 66: 26=642^6 = 64
      • Bit 77 (far left): 27=1282^7 = 128
    • Worked Binary-to-Decimal Example:
      • To find the decimal equivalent of the 88-bit binary number 10011101210011101_2:
      • (1×27)+(0×26)+(0×25)+(1×24)+(1×23)+(1×22)+(0×21)+(1×20)(1 \times 2^7) + (0 \times 2^6) + (0 \times 2^5) + (1 \times 2^4) + (1 \times 2^3) + (1 \times 2^2) + (0 \times 2^1) + (1 \times 2^0)
      • 128+0+0+16+8+4+0+1=157128 + 0 + 0 + 16 + 8 + 4 + 0 + 1 = 157
      • Therefore, the bit pattern 1001110110011101 represents the decimal number 157157
    • Storage Capacity Limits:
      • The maximum decimal integer value that can fit into a single 88-bit byte (where all bits are set to 11) is 28−1=2552^8 - 1 = 255
      • To store integers greater than 255255, systems combine multiple adjacent bytes. A 22-byte (1616-bit) memory block can store values up to 216−1=655352^{16} - 1 = 65535
  • Advanced Data Formats:

    • Negative Integers: Encoded using two's complement binary representation.
    • Real Numbers (Decimals): Encoded using floating-point notation.
    • Character Data: Textual characters are mapped to numeric codes and stored as binary values.
      • ASCII (American Standard Code for Information Interchange): A standard set of 128128 numeric codes representing English letters, numbers, and basic punctuation. For instance, uppercase letter 'A' is represented by code 6565
      • Unicode: An expanded character-encoding standard that is fully backward-compatible with ASCII but contains codes for the written scripts and characters of all major global languages.
    • Digital Media:
      • Digital Data: Any data stored using binary representation.
      • Digital Images: Composed of thousands of individual color dots called pixels (picture elements), where each pixel's color values are stored in binary.
      • Digital Audio: Sound converted into numeric digital format by breaking continuous audio waves into small discrete measurements called samples.

CPU Execution Mechanics and Program Translation

  • Native CPU Capabilities:

    • The CPU is an electronic component that executes lower-level operations deterministically.
    • Core operations built into a CPU include:
      • Reading data from a designated location in main memory.
      • Adding two numbers.
      • Subtracting one number from another.
      • Multiplying two numbers.
      • Dividing one number by another.
      • Moving data from one main memory location to another.
      • Testing whether two values are equal to each other.
  • Machine Language and Instruction Sets:

    • A CPU directly understands only machine language, which consists entirely of binary sequences of 00s and 11s.
    • The complete set of commands that a CPU is built to execute is called its instruction set.
    • Microprocessor manufacturers (such as Intel, AMD, and Motorola) construct chips with distinct, proprietary instruction sets.
  • The Fetch-Decode-Execute Cycle:

    • The continuous sequence executed by the CPU to run a program is called the Fetch-Decode-Execute Cycle:
      1. Fetch: The CPU reads the next binary instruction from main memory.
      2. Decode: The CPU decodes the instruction to identify the electronic operation to perform.
      3. Execute: The CPU carries out the operation.
  • Language Hierarchy and Abstraction:

    • Assembly Language: A low-level programming language that replaces raw binary machine code with short, memorable terms known as mnemonics (e.g., ADD, MOV, SUB).
    • Assembler: A specialized program that translates an assembly language program into machine language.
    • High-Level Languages: Languages that allow software developers to write complex programs using understandable words and logical expressions without needing to know how specific CPU hardware functions. Examples include Java, C++, Python, Visual Basic, C#, Ada, and Fortran.
  • Key High-Level Programming Concepts:

    • Key Words / Reserved Words: Specialized words that have explicit, predefined meanings in a language and cannot be repurposed.
    • Operators: Symbols or words that perform arithmetic or logical operations on data.
    • Syntax: The exact set of rules that must be followed when writing source code.
    • Statements: Individual command lines written in a programming language.
    • Source Code: The program statements written in a high-level language before translation.
  • Compilers vs. Interpreters:

    • Syntax Error: A violation of programming syntax rules, such as a misspelled keyword, missing punctuation mark, or improper operator usage.
    • Compiler: A program that translates an entire high-level program into a separate, standalone machine language executable file that can be run independently at any time.
    • Interpreter: A program that sequentially translates and executes each line of a high-level program on the fly during runtime, without generating a separate executable file.

Software Classification

  • System Software:

    • Programs that manage and maintain the fundamental underlying hardware operations of a computer.
    • Operating Systems (OS): Control internal hardware operations, manage connected hardware peripherals, and manage system resources.
    • Utility Programs: Specialized routines that enhance computer functionality or protect system data (e.g., security utilities, file maintenance software).
    • Software Development Tools: Software tools used by programmers to write, edit, compile, and debug software applications.
  • Application Software:

    • End-user programs designed to accomplish practical tasks and daily workflows.
    • Examples include word processing programs, spreadsheet software, database tools, presentation systems, web browsers, and email software.