04 Computer Systems

Types of computer systems

Hardware: the physical components that make up a computer

Software: the instructions that control the computer's physical components.

Computer systems can be split into two main categories:

General purpose systems

  • Computer systems that can perform many tasks and have replaceable software, for example a PC or Mac (desktop or laptop), tablet, or smartphone.

Embedded systems

  • Computer systems that are built in to another device to support their operation and have specific software (firmware) "burned" onto the chips.

    reliable

    cheap to mass-produce

    energy efficient

Logic Gates

0 Off / 1 On

AND [A.B]: ‘On’ if both inputs are on

OR [A+B]: ‘On’ if either or both inputs are on

NOT [A (+ overbar)]: Invert their single input (on → off / off → on)

XOR [AB]: ‘On’ if either inputs are on, not both

Computer memory

<aside> 🧠 Main memory

  • Comes in two forms - ROM (Read-Only Memory) and RAM (Random Access Memory)

  • Directly accessed by the CPU

  • Contains the instructions that the CPU executes during the fetch-execute cycle

  • Essential for a computer to function

  • RAM stores data and instructions that are currently in use </aside>

<aside> 📁 Secondary Storage

  • Indirectly accessed by the CPU

  • Larger, but slower than primary memory

  • Used for long-term / permanent storage of data and applications

  • Provided by hard disks, solid state drives, optical storage and magnetic tape

  • Program instructions must be loaded into RAM before they can be executed by the CPU! </aside>

  • RAM (Random Access Memory):

    • Temporarily stores program instructions and data while being processed by the CPU.

    • Volatile, contents lost when power is off.

    • Faster but more expensive than secondary storage.

    • Holds programs and data in use, including the OS during boot-up.

  • ROM (Read Only Memory):

    • Permanently stores program instructions and data.

    • Non-volatile, contents retained when power is off.

    • Used for boot-up sequence or BIOS, cannot be altered without re-flashing.

  • Usage of RAM and ROM:

    • ROM contains BIOS for boot-up, while RAM holds OS and programs during operation.

  • Registers and Cache Memory:

    • Registers store data needed during CPU's fetch-execute cycle.

    • Cache memory (SRAM) stores recently fetched instructions for quick retrieval.

  • Need for Secondary Storage:

    • RAM limitations (volatility and capacity) necessitate secondary storage for permanent retention and virtual memory expansion.

CPU

  • Von Neumann Architecture:

    • Includes processing unit (with ALU and registers), control unit, main memory, and buses.

    • Modern CPUs combine control unit, ALU, and registers in a single chip.

  • Factors Affecting CPU Performance:

    • Clock Speed:

      • Determines how fast instructions are processed, measured in GHz.

      • Higher clock speed generally means more instructions processed per second.

    • CPU Cores:

      • Modern CPUs have multiple cores for parallel processing.

      • Each core has its own control unit, ALU, and cache memory.

      • Programs need optimization for parallel processing to benefit from multiple cores.

    • Cache Memory:

      • Very fast memory within the CPU storing frequently used data and instructions.

      • Helps CPU retrieve data more quickly than from RAM.

      • More cache memory improves speed but is expensive.

      • Modern CPUs have three levels of cache, with size increasing from L1 to L3.

      • L1 and L2 caches are typically SRAM, providing stability, while L3 cache can use DRAM for faster changes and recalls.

Secondary Storage

  • Storage Technologies:

    • Magnetic Storage:

      • Includes hard disks, magnetic tapes, and floppy disks.

      • Hard disks offer large capacities at a low cost per GB and are suitable for long-term storage.

      • How do hard disks work?

        • Hard disks contain multiple metal discs called platters which spin at very high speeds (between 5,400 and 10,000 RPM).

        • The surface of the platters contains many tiny magnetized regions, the magnetic orientation of which represents a 0 in one direction and a 1 in the other.

        • Each platter is divided into tracks and sectors, the intersections of which are called blocks. This allows the location of specific files/data to be stored in an index (a "file allocation table").

        • As the platters spin, a magnetic read/write head is moved to the correct track on the disk where data should be read or written to.

        • Data is read by the read/write head one block at a time and is transferred to an I/O controller on the motherboard via a data cable.

    • Flash Memory:

      • Includes SSDs, USB sticks, and SD cards.

      • Data is stored using transistors, with no moving parts, allowing for faster access times.

      • SSDs are increasingly popular due to their speed and reliability, albeit at a higher cost.

    • Optical Storage:

      • Utilizes CDs, DVDs, and Blu-ray discs.

      • Data is encoded on the disc's surface as transitions between pits and lands.

      • The laser light detects these transitions, with shorter wavelengths needed for smaller pits.

      • Comes in ROM, R, and RW formats, each with different write capabilities.

      • Prone to scratching, and RW discs are particularly unreliable for long-term storage.

  • Cloud Storage:

    • Advantages:

      • Allows access from any Internet-connected device, facilitating easy sharing and collaboration.

      • Provides offsite backup and increased storage capacity.

      • Managed security and backup by hosting companies.

    • Disadvantages:

      • Requires a reliable Internet connection, dependency on host management.

      • Potential security risks, unclear data ownership, and ongoing subscription fees.

Software

  • System Software:

    • Manages and controls the computer system.

    • Divided into Operating Systems (OS) and Utility Software.

  • Operating Systems (OS):

    Operating Systems are essential on modern computer systems that can run different applications on a range of different hardware.

    An Operating System is needed to:

    • Manage memory between running applications and processes

    • Allocate processor time to different processes/tasks

    • Manage input/output devices including responding to events such as key-presses and mouse clicks

    • Provide an interface between users, applications and the system's hardware

  • Utility Software:

    • Subset of system software performing specific maintenance tasks.

    • Examples include encryption, defragmentation, data compression, and backup software.

Operating Systems Functions:

  • Memory Management: Controls computer memory usage and allocation.

  • Processor Management: Schedules processes for execution.

  • Input/Output Management: Handles device interactions and network communication.

  • Storage Management: Manages secondary storage devices and space allocation.

  • Security Management: Authenticates users, protects against malware, and controls access.

  • Application Management: Regulates application access and usage.

Utility Software Examples:

  • Encryption Software: Secures files by scrambling data with encryption algorithms.

  • Defragmentation: Improves hard disk performance by reorganizing fragmented data.

  • Data Compression: Reduces file sizes using compression algorithms, commonly used for file transfer.

  • Backup Software: Creates copies of data for restoration in case of data loss, manages backup processes and media.

HDD vs SDD (factors)

  • Speed:

    • HDD: Slower due to mechanical components; speed affected by seek time and rotational latency.

    • SSD: Faster access times and data transfer rates due to lack of mechanical parts.

  • Durability:

    • HDD: Prone to mechanical failure, sensitive to physical shocks or vibrations.

    • SSD: More durable with no moving parts; resistant to shock and vibration damage.

  • Noise and Heat:

    • HDD: Generates noise from spinning platters and moving heads; produces heat during operation.

    • SSD: Silent operation as there are no moving parts; generates less heat compared to HDD.

  • Power Consumption:

    • HDD: Consumes more power due to moving parts and spinning platters.

    • SSD: Requires less power, contributing to longer battery life in laptops and lower energy costs in desktops.

  • Price and Capacity:

    • HDD: Generally cheaper per GB compared to SSDs, available in larger capacities.

    • SSD: More expensive per GB but becoming more affordable over time; available in smaller capacities compared to HDDs.

  • Form Factor:

    • HDD: Typically larger in physical size due to mechanical components.

    • SSD: Compact and lightweight design due to absence of moving parts, suitable for slim devices like ultra books and tablets.

Fetch execute cycle

The fetch-execute cycle is a crucial process performed by the CPU in a computer. It involves three main steps: fetch, decode, and execute. During the fetch stage, the CPU retrieves the next instruction from memory. In the decode stage, it interprets the instruction to understand the operation to be performed. Finally, in the execute stage, the CPU carries out the instruction. This cycle repeats continuously, allowing the CPU to execute program instructions and perform various tasks, ensuring the smooth operation of the computer system.