Lecture 1.
Basic
Structure of Computers
Introduction
●   Computer Hardware: electronic circuits,
    displays, magnetic and optical storage media,
    electromechnical equipment, communication
    facilities
●   Computer Architecture: instruction set and
    hardware units that implements the
    instructions
Computer Types
●   Definition of digital computer
●   Based on storage capacity and computing
    power
    ●   Personal computer
    ●   Workstations
    ●   Enterprise systems and servers
    ●   Supercomputers
Functional Units
Functional Units
                                               Arithmeti
    Inpu                                       c an
    t                                              d
                                                  logi
                                                  c
                        Memor
                        y
    Outpu                                       Contro
    t                                           l
            I/O                                      Processo
                                                     r
     Figure 1.1. Basic functional units of a
     computer.
Information Handled by a
Computer
●   Instructions/machine instructions
    Govern the transfer of information within a computer as
    well as between the computer and its I/O devices
    Specify the arithmetic and logic operations to be
    performed
    Program consists of data and set of instructions
●   Data
    Used as operands by the instructions
    Source program may also be data (to compiler)
●   Encoded in binary code – 0 and 1
Memory Unit
●   Store programs and data
●   Two classes of storage
    Primary storage
❖   Fast
❖   Programs must be stored in memory while they are being executed
❖   Large number of semiconductor storage cells
❖   Processed in words (Example)
❖   Address
❖   RAM and memory access time
❖   Memory hierarchy – cache, main memory
    Secondary storage – larger and cheaper
Arithmetic and Logic Unit
(ALU)
●   Most computer operations are executed in
    ALU of the processor.
●   Load the operands into memory – bring them
    to the processor – perform operation in ALU –
    store the result back to memory or retain in
    the processor.
●   Registers
●   Fast control of ALU: Enables a single
    processor to control a number of external
    devices
Control Unit
●   All computer operations are controlled by the control
    unit.
●   The timing signals that govern the I/O transfers are
    also generated by the control unit, also for data
    transfers between memory and processor
●   Control unit is usually distributed throughout the
    machine instead of standing alone.
●   Operations of a computer:
    Accept information in the form of programs and data through an
    input unit and store it in the memory
    Fetch the information stored in the memory, under program control,
    into an ALU, where the information is processed
    Output the processed information through an output unit
    Control all activities inside the machine through a control unit
Basic Operational
       Concepts
Review
●   Activity in a computer is governed by instructions.
●   To perform a task, an appropriate program
    consisting of a list of instructions is stored in the
    memory.
●   Individual instructions are brought from the memory
    into the processor, which executes the specified
    operations.
●   Data to be used as operands are also stored in the
    memory.
A Typical Instruction
●   Add LOCA, R0
●   Add the operand at memory location LOCA to the
    operand in a register R0 in the processor.
●   Place the sum into register R0.
●   The original contents of LOCA are preserved.
●   The original contents of R0 is overwritten.
●   Instruction is fetched from the memory into the
    processor – the operand at LOCA is fetched and
    added to the contents of R0 – the resulting sum is
    stored in register R0.
Separate Memory Access and
ALU Operation
●   Load LOCA, R1
●   Add R1, R0
●   Whose contents will be overwritten?
Connection Between the
Processor and the Memory
Registers
●   Instruction register (IR)
●   Program counter (PC)
●   General-purpose register (R0 – Rn-1)
●   Memory address register (MAR)
●   Memory data register (MDR)
Typical Operating Steps
●   Programs reside in the memory through input
    devices
●   PC is set to point to the first instruction
●   The contents of PC are transferred to MAR
●   A Read signal is sent to the memory
●   The first instruction is read out and loaded
    into MDR
●   The contents of MDR are transferred to IR
●   Decode and execute the instruction
Typical Operating Steps (Cont’)
●   Get operands for ALU
     General-purpose register
     Memory (address to MAR – Read – MDR to ALU)
●   Perform operation in ALU
●   Store the result back
     To general-purpose register
     To memory (address to MAR, result to MDR – Write)
●   During the execution, PC is
    incremented to the next instruction
Interrupt
●   Normal execution of programs may be preempted if
    some device requires urgent servicing.
●   The normal execution of the current program must
    be interrupted – the device raises an interrupt signal.
●   Interrupt-service routine
●   Current system information backup and restore (PC,
    general-purpose registers, control information,
    specific information)
Bus Structures
●   There are many ways to connect different
    parts inside a computer together.
●   A group of lines (each line carry 1 bit of
    information) that serves as a connecting path
    for several devices is called a bus.
●   Address/data/control
Bus Structure
●   Single-bus
Speed Issue
●   Different devices have different
    transfer/operate speed.
●   If the speed of bus is bounded by the slowest
    device connected to it, the efficiency will be
    very low.
●   How to solve this?
●   A common approach – use buffers.
Software
System Software
●   System software is a collection of programs that are
    executed as needed to perform functions such as-
    ●   Receiving and interpreting user commands
    ●   Entering and editing application programs and storing them
        as files in secondary devices.
    ●   Managing the storage and retrieval of files in secondary
        storage devices.
    ●   Running standard application programs such as word
        processors, games with data supplied by the user.
    ●   Controlling I/O units to receive input information and
        produce output results.
    ●   Translating programs from source form prepared by the
        user into object form consisting of machine instructions.
    ●   Linking and running user-written application programs with
        existing standard library routines, such as numerical
        computation packages.
Operating System(OS)
●   It is a collection of routines, that is used to control the sharing of and
    interaction among various computer units as they execute
    application programs.
●   OS routines perform tasks required to assign computer resources to
    individual application programs.
●   Tasks include assigning magnetic disk space to program and data
    files, moving data between memory and disk units, and handling I/O
    operations.
Performance
Performance
●   The most important measure of a computer is
    how quickly it can execute programs.
●   Three factors affect performance:
    Hardware design
    Instruction set
    Compiler
Performance
●   Processor time to execute a program depends on the hardware
    involved in the execution of individual machine instructions.
              Main                     Cache
             memory                   memory     Processor
                              Bus
                  Figure      The processor
                  1.5.        cache.
Performance
●   The processor and a relatively small cache
    memory can be fabricated on a single
    integrated circuit chip.
●   Speed
●   Cost
●   Memory management
Processor Clock
●   Processor circuits are controlled by a timing signal called a
    Clock.
●   The clock defines regular time intervals, called clock cycle.
●   The execution of each instruction is divided into several
    steps, each of which completes in one clock cycle.
●   The length P of one clock cycle affects processor
    performance.
●   The clock rate is inverse of P. i.e., R =1/P cycles per
    second.
●   If P = 1ns then R will be 1 GHz.
●   Hertz – cycles per second
Basic Performance Equation
●   T – processor time required to execute a program that has been
    prepared in high-level language
●   N – number of actual machine language instructions needed to
    complete the execution (note: loop)
●   S – average number of basic steps needed to execute one
    machine instruction. Each step completes in one clock cycle
●   R – clock rate
●   Note: these are not independent to each other
       How to improve T?
Pipeline and Superscalar
Operation
●   Instructions are not necessarily executed one after
    another.
●   The value of S doesn’t have to be the number of
    clock cycles to execute one instruction.
●   Pipelining – overlapping the execution of successive
    instructions.
●   Example: Add R1, R2, R3
●   Superscalar operation – multiple instruction
    pipelines are implemented in the processor.
●   Goal – reduce S (could become <1!)
●   Issue: Must preserve Logical correctness of the
    program
Clock Rate
●   Increase clock rate
    Improve the integrated-circuit (IC) technology to make
    the circuits faster
    Reduce the amount of processing done in one basic step
    (however, this may increase the number of basic steps
    needed)
●   Increases in R that are entirely caused by
    improvements in IC technology affect all
    aspects of the processor’s operation equally
    except the time to access the main memory.
CISC and RISC
●   Tradeoff between N and S
●   A key consideration is the use of pipelining
    S is close to 1 even though the number of basic steps
    per instruction may be considerably larger
    It is much easier to implement efficient pipelining in
    processor with simple instruction sets
●   Reduced Instruction Set Computers (RISC)
●   Complex Instruction Set Computers (CISC)
Compiler
●   A compiler translates a high-level language program
    into a sequence of machine instructions.
●   To reduce N, we need a suitable machine instruction
    set and a compiler that makes good use of it.
●   Goal – reduce N×S
●   A compiler may not be designed for a specific
    processor; however, a high-quality compiler is
    usually designed for, and with, a specific processor.
Performance Measurement
●   T is difficult to compute.
●   Measure computer performance using benchmark programs.
●   System Performance Evaluation Corporation (SPEC) selects and
    publishes representative application programs for different application
    domains, together with test results for many commercially available
    computers.
●   Compile and run (no simulation)
●   Reference computer