Computer Organization Computer Organization Hardware and Software
Computer OrganizationComputer Organization
Hardware and Software
Computing SystemsComputing Systems
Computers have two kinds of components:Computers have two kinds of components:
• HardwareHardware, Hardware, Hardware Any machinery (most of which uses digital Any machinery (most of which uses digital
circuits) that assists in the input, processing, circuits) that assists in the input, processing, storage, and output activities of an storage, and output activities of an information system information system
consisting of its physical devices (CPU, consisting of its physical devices (CPU, memory, bus, storage devices, ...)memory, bus, storage devices, ...)
• SoftwareSoftware, consisting of the programs it , consisting of the programs it has (Operating system, applications, has (Operating system, applications, utilities, ...)utilities, ...)
Computer GenerationsComputer Generations HardwareHardware SoftwareSoftware
11stst Vacuum TubesVacuum Tubesmachine languagemachine language
22ndnd TransistorsTransistors Assembly languageAssembly language
33rdrd Integrated Chip (IC)Integrated Chip (IC) Higher level Higher level languages, Application Programslanguages, Application Programs
4th4th VLSI (Very Large Scale ICs) VLSI (Very Large Scale ICs) Object Object oriented programming, natural language processingoriented programming, natural language processing
The Binary SystemThe Binary SystemBitsBits – Binary digits, or 0,1. – Binary digits, or 0,1.
BytesBytes (8 bits) – ASCII, EBCDIC (8 bits) – ASCII, EBCDICOne byte is the space needed to store one One byte is the space needed to store one character, like the letter “A”.character, like the letter “A”.
KilobyteKilobyte (KB) – 1000 (actually, 1024) (KB) – 1000 (actually, 1024)
MegabyteMegabyte (MB) – 1,000,000 (MB) – 1,000,000
GigabyteGigabyte (GB) – 1,000,000,000 (GB) – 1,000,000,000
TerabyteTerabyte (TB) – 1,000,000,000,000 (TB) – 1,000,000,000,000
Types of Computer Systems Types of Computer Systems (1)(1)• Personal computers (PCs)Personal computers (PCs)
– Small, inexpensive, often called microcomputersSmall, inexpensive, often called microcomputers
• Network computersNetwork computers– Used for accessing networks, especially the InternetUsed for accessing networks, especially the Internet
• WorkstationsWorkstations– Fit between high-end microcomputers and low-end Fit between high-end microcomputers and low-end
midrangemidrange
• Midrange (or ‘mini’) computers Midrange (or ‘mini’) computers – Size of a three drawer file cabinet and accommodates Size of a three drawer file cabinet and accommodates
several users at one timeseveral users at one time
• Mainframe computers Mainframe computers – Large and powerful, shared by hundreds concurrentlyLarge and powerful, shared by hundreds concurrently
• Supercomputers Supercomputers – Most powerful with fastest processing speedsMost powerful with fastest processing speeds
Hardware ComponentsHardware Components• Central processing unit (CPU)Central processing unit (CPU)
– A hardware component that performs A hardware component that performs computing functions utilizing the ALU, control computing functions utilizing the ALU, control unit, and registers.unit, and registers.
• Arithmetic/logic unit (ALU)Arithmetic/logic unit (ALU)– Performs mathematical calculations and Performs mathematical calculations and
makes logical comparisonsmakes logical comparisons
• Control unit(CU)Control unit(CU)– Sequentially accesses program instructions, Sequentially accesses program instructions,
decodes them, coordinates flow of data in/out decodes them, coordinates flow of data in/out of ALU, registers, primary and secondary of ALU, registers, primary and secondary storage, and various output devicesstorage, and various output devices
Hardware ComponentsHardware Components• RegistersRegisters
– High-speed storage areas used to High-speed storage areas used to temporarily hold small units of program temporarily hold small units of program instructions and data immediately instructions and data immediately before, during, and after execution by before, during, and after execution by the CPUthe CPU
• Primary storagePrimary storage
– Holds program instructions and data Holds program instructions and data (a.k.a. main memory)(a.k.a. main memory)
Hardware: CPUHardware: CPU
Central Processing Unit (CPU):Central Processing Unit (CPU):– the “brain” of the machinethe “brain” of the machine
– location of circuitry that performs location of circuitry that performs arithmetic and logical ML statementsarithmetic and logical ML statements
– measurement: speed (roughly) in measurement: speed (roughly) in megahertz (millions of clock-ticks per megahertz (millions of clock-ticks per second)second)
– examples: Intel Pentium, AMD K6, examples: Intel Pentium, AMD K6, Motorola PowerPC, Sun SPARC, Motorola PowerPC, Sun SPARC,
• CPU = Control Unit + ALU + Registers.CPU = Control Unit + ALU + Registers.
• Control unitControl unit: monitors and directs : monitors and directs sequences of instructions.sequences of instructions.
• ALU (Arithmetic-Logic Unit)ALU (Arithmetic-Logic Unit): performs : performs simple arithmetic and logical simple arithmetic and logical operations.operations.– Examples: Add, subtract, and, or, invert, Examples: Add, subtract, and, or, invert,
increment, etc.increment, etc.A B
ALUselect
R = A op B
n-bits operations
R
• RegistersRegisters: Fast memories in the CPU, : Fast memories in the CPU, storing operands, temporary results storing operands, temporary results and status information.and status information.
• General-purpose registers and special General-purpose registers and special registers:registers:– PC (program counter)PC (program counter)
– ACC (accumulator)ACC (accumulator)
– IR (instruction register)IR (instruction register)
– MAR (memory address register)MAR (memory address register)
– MBR (memory buffer register) or MDR MBR (memory buffer register) or MDR (memory data register)(memory data register)
Program inHigh-level language
(C, Pascal, etc)
Compile program into assembly language
Assemble programto machine language
Link multiplemachine-language programs
to one program
Load program into computer’s memory
Execute program
The organization of a simple computer The organization of a simple computer with with one CPU and two I/O devicesone CPU and two I/O devices
CPU Organization :CPU Organization :The data path of a typical Von Neumann The data path of a typical Von Neumann machinemachine
Execution of an Execution of an InstructionInstruction• Machine cycleMachine cycle
– Instruction phaseInstruction phase
– Execution phaseExecution phase
• Instruction phaseInstruction phase– Step 1: Fetch instructionStep 1: Fetch instruction
– Step 2: Decode instructionStep 2: Decode instruction
• Execute phaseExecute phase– Step 3: Execute instructionStep 3: Execute instruction
– Step 4: Store resultsStep 4: Store results
Instruction
Fetch
Instruction
Decode
Operand
Fetch
Execute
Result
Store
Next
Instruction
•Instruction execution cycle: fetch, decode, execute.
•Fetch: fetch next instruction (using PC) from memory into IR.•Decode: decode the instruction.
•Execute: execute instruction.
Pipelining: A CPU operation in which Pipelining: A CPU operation in which multiple execution phases are multiple execution phases are performed in a single machine cycleperformed in a single machine cycle
Machine Cycle TimeMachine Cycle Time• Machine cycle timeMachine cycle time
– Time it takes to execute an instructionTime it takes to execute an instruction
• Slow machinesSlow machines
– Measured in microseconds (one-millionth of a Measured in microseconds (one-millionth of a second)second)
• Fast machinesFast machines
– Measured in nanoseconds (one-billionth of a second) Measured in nanoseconds (one-billionth of a second) to picoseconds (one-trillionth of a second)to picoseconds (one-trillionth of a second)
• MIPSMIPS
– Millions of instructions per secondMillions of instructions per second
Cycle Time:Cycle Time:
Clock Speed:Clock Speed:
• Clock speedClock speed– Predetermined rate a CPU produces a series of Predetermined rate a CPU produces a series of
electronic pulses.electronic pulses.
• Hertz (Hz)Hertz (Hz)– One cycle or pulse per secondOne cycle or pulse per second
• Megahertz (MHz)Megahertz (MHz)– Millions of cycles per secondMillions of cycles per second
WordlengthWordlength• WordlengthWordlength
– Number of bits the CPU can process at any one Number of bits the CPU can process at any one timetime
• BITBIT
– ‘‘Binary digit’ - 0 or 1 that combine to form a Binary digit’ - 0 or 1 that combine to form a “word”“word”
• Computer wordComputer word
– What the computer processesWhat the computer processes
• MicrocodeMicrocode
– Predefined, elementary circuits and logical Predefined, elementary circuits and logical operations that the processor performs when it operations that the processor performs when it executes an instructionexecutes an instruction
Instruction Execution Instruction Execution StepsSteps• Fetch next instruction from memory into instr. Fetch next instruction from memory into instr.
registerregister
• Change program counter to point to next Change program counter to point to next instructioninstruction
• Determine type of instruction just fetchedDetermine type of instruction just fetched
• If instructions uses word in memory, determine If instructions uses word in memory, determine where Fetch word, if needed, into CPU registerwhere Fetch word, if needed, into CPU register
• Execute the instructionExecute the instruction
• Go to step 1 to begin executing following Go to step 1 to begin executing following instructioninstruction
Main memory :consists of a number of storage locations, each of which is identified by a unique address
Types of main memory
There are two types of main memory, Random Access Memory (RAM) and Read Only Memory (ROM)
Types of RAM.1- Dynamic Random Access Memory (DRAM)
Contents are constantly refreshed 1000 times per second
Access time 60 – 70 nanoseconds
Note: a nanosecond is one billionth of a second!
2-Synchronous Dynamic Random Access Memory (SDRAM)
Quicker than DRAM
Access time less than 60 nanoseconds
3-Direct Rambus Dynamic Random Access Memory (DRDRAM)
New type of RAM architecture
Access time 20 times faster than DRAM
More expensive
4-Static Random Access Memory (SRAM)
Doesn’t need refreshing
Retains contents as long as power applied to the chip
Access time around 10 nanoseconds
Used for cache memory
Also for date and time settings as powered by small battery
5-Cache memory
Small amount of memory typically 256 or 512 kilobytes
Temporary store for often used instructions
Level 1 cache is built within the CPU (internal)
Level 2 cache may be on chip or nearby (external)
Faster for CPU to access than main memory
6-Video Random Access memory
Holds data to be displayed on computer screen
Has two data paths allowing READ and WRITE to occur at the same time
A system’s amount of VRAM relates to the number of colours and resolution
A graphics card may have its own VRAM chip on board
7-Virtual memory
Uses backing storage e.g. hard disk as a temporary location for programs and data where insufficient RAM available
Swaps programs and data between the hard-disk and RAM as the CPU requires them for processing
A cheap method of running large or many programs on a computer system
Cost is speed: the CPU can access RAM in nanoseconds but hard-disk in milliseconds (Note: a millisecond is a thousandth of a second)
Virtual memory is much slower than RAM
Notes:Random Access Memory (RAM)Notes:Random Access Memory (RAM)
– ““main” memory, which is fast, but main” memory, which is fast, but volatilevolatile......
– analogous to a person’s short-term memory.analogous to a person’s short-term memory.
– many tiny “on-off” switches: for conveniencemany tiny “on-off” switches: for convenience
• ““on” is represented by 1, “off” by 0.on” is represented by 1, “off” by 0.
– each switch is called a each switch is called a bbinary diginary digitit, or , or bitbit..
• 8 bits is called a 8 bits is called a bytebyte..
• 221010 bytes =1024 bytes is called a bytes =1024 bytes is called a kilobytekilobyte (1K) (1K)
• 222020 bytes is called a bytes is called a megabytemegabyte (1M). (1M).
There are two basic types of RAM: There are two basic types of RAM:
dynamic RAM (DRAM) dynamic RAM (DRAM)
static RAM (SRAM) static RAM (SRAM)
Main
Memory
(DRAM)
CPU
Cache
Memory
(SRAM)
= Bus connections
1. Cache fetches data from next to current addresses in main memory
2. CPU checks to see whether the next instruction it requires is in cache
4. If not, the CPU has to fetch next instruction from main memory - a much slower process
3. If it is, then the instruction is fetched from the cache – a very fast position
Read only memory (ROM)
• ROM holds programs and data permanently even when computer is switched off
• Data can be read by the CPU in any order so ROM is also direct access
• The contents of ROM are fixed at the time of manufacture
• Stores a program called the bootstrap loader that helps start up the computer
• Access time of between 10 and 50 nanoseconds
Types of ROM
• 1. Programmable Read Only Memory (PROM)
• Empty of data when manufactured
• May be permanently programmed by the user
2. Erasable Programmable Read Only Memory (EPROM)
• Can be programmed, erased and reprogrammed
• The EPROM chip has a small window on top allowing it to be erased by shining ultra-violet light on it
• After reprogramming the window is covered to prevent new contents being erased
• Access time is around 45 – 90 nanoseconds
• 3. Electrically Erasable Programmable Read Only Memory (EEPROM)
• Reprogrammed electrically without using ultraviolet light
• Must be removed from the computer and placed in a special machine to do this
• Access times between 45 and 200 nanoseconds
4. Flash ROM
• Similar to EEPROM
• However, can be reprogrammed while still in the computer
• Easier to upgrade programs stored in Flash ROM
• Used to store programs in devices e.g. modems
• Access time is around 45 – 90 nanoseconds
5. ROM cartridges
• Commonly used in games machines
• Prevents software from being easily copied
StorageStorage• Hard DriveHard Drive
– 160 GB on upwards today160 GB on upwards today
– As low as 256 KB less than 20 years ago!As low as 256 KB less than 20 years ago!
• CD-ROMCD-ROM
– 600-700 MB600-700 MB
• DVD-ROMDVD-ROM
– 4 GB - Red Laser, 27 GB- Blue Laser 4 GB - Red Laser, 27 GB- Blue Laser
• Flash DrivesFlash Drives
– From 256 MB up to 100+ GBFrom 256 MB up to 100+ GB
Memory HierarchiesMemory Hierarchies
•A five-level memory hierarchy
Access Methods and Storage Access Methods and Storage DevicesDevices
• SequentialSequential– Data retrieved in the order stored.Data retrieved in the order stored.
• DirectDirect– Data retrieved without the need to read or Data retrieved without the need to read or
pass other data in sequencepass other data in sequence
• Storage DevicesStorage Devices– Sequential Access Storage Devices (SASDs)Sequential Access Storage Devices (SASDs)– Direct Access Storage Devices (DASDs)Direct Access Storage Devices (DASDs)
Hardware (Disk)Hardware (Disk)
Secondary Memory (Disk): Stores large Secondary Memory (Disk): Stores large amounts of data, instructions, and amounts of data, instructions, and information more permanently than main information more permanently than main memorymemory– Stable storage using magnetic or optical media.Stable storage using magnetic or optical media.
– Analogous to a person’s long-term memory.Analogous to a person’s long-term memory.
– Slower to access than RAM.Slower to access than RAM.
– Examples: Examples: • floppy disk (measured in kilobytes)floppy disk (measured in kilobytes)
• hard disk (measured in gigabytes (2hard disk (measured in gigabytes (23030 bytes)) bytes))
• CD-ROM (measured in megabytes), ...CD-ROM (measured in megabytes), ...
Devices for Secondary Devices for Secondary StorageStorage
– Magnetic tape and disksMagnetic tape and disks
– Compact Disk Read-Only Memory (CD-ROM)Compact Disk Read-Only Memory (CD-ROM)
– Write Once Read Many - (WORM)Write Once Read Many - (WORM)
– Magneto-optical disksMagneto-optical disks
– Redundant Array of Inexpensive Disks (RAID)Redundant Array of Inexpensive Disks (RAID)
– Optical disksOptical disks
– Digital Video DisksDigital Video Disks
– Memory cardsMemory cards
– Flash memoryFlash memory
– Removable storageRemovable storage
Magnetic Disks (1)Magnetic Disks (1)
•A portion of a disk track. Two sectors are illustrated
Magnetic Disks (2)Magnetic Disks (2)
•A disk with four platters
Magnetic Disks (3)Magnetic Disks (3)
A disk with five zones. Each zone has many tracks.
CD-ROMs (1)CD-ROMs (1)
•Recording structure of a Compact Disk or CD-ROM
CD-RecordablesCD-Recordables
Cross section of a CD-R disk and laser (not to scale). A CD-ROM has a similar structure, except without the dye layer and with a pitted aluminum layer instead of a reflective layer
Comparison of Secondary Comparison of Secondary Storage DevicesStorage Devices
Hardware: the BusHardware: the Bus
The Bus:BusThe Bus:BusPhysical wiring connecting computer Physical wiring connecting computer
componentscomponents
– Connects CPU to other hardware devices.Connects CPU to other hardware devices.
– Analogous to a person’s spinal cord.Analogous to a person’s spinal cord.
– Speed measured in megahertz (like the CPU), Speed measured in megahertz (like the CPU), but typically much slower than the CPU... but typically much slower than the CPU...
– The bottleneck in most of today’s PCs.The bottleneck in most of today’s PCs.
• Bus widthBus width– Number of bits a bus can transfer at one timeNumber of bits a bus can transfer at one time
Hardware: CacheHardware: Cache
While accessing RAM is faster than While accessing RAM is faster than accessing secondary memory, it is still accessing secondary memory, it is still quite slow, relative to the rate at which quite slow, relative to the rate at which the CPU runs.the CPU runs.
To circumvent this problem, most systems To circumvent this problem, most systems add a fast add a fast cache memorycache memory to the CPU, to to the CPU, to store recently used instructions and data.store recently used instructions and data.
(Assumption: Since such instructions/data (Assumption: Since such instructions/data were needed recently, they will be needed were needed recently, they will be needed again in the near future.)again in the near future.)
The cache is logically between the CPU and The cache is logically between the CPU and main memory. Physically, there are several main memory. Physically, there are several possible places it could be located.possible places it could be located.
Cache memoryHigh speed memory that a processor can access more rapidly than main memory
Logical structure of a simple Logical structure of a simple personal computerpersonal computer
Input and Output DevicesInput and Output Devices• Data entryData entry
– The process by which human-readable data is The process by which human-readable data is converted into a machine-readable form.converted into a machine-readable form.
• Data inputData input– The process of transferring machine-readable The process of transferring machine-readable
data into the computer system.data into the computer system.
• Source data automationSource data automation– Capturing and editing data where the data is Capturing and editing data where the data is
originally created and in a form that can be originally created and in a form that can be directly input to a computerdirectly input to a computer
Input DevicesInput Devices• PC input devices
• Voice recognition devices
• Digital computer cameras
• Terminals
Keyboard, Mouse, Camera, Touch Pad
• Scanning devices
• Optical data readers
• Magnetic Ink Character
• Recognition (MICR)
• Point Of Sale (POS) devicesAutomatic Teller Machine (ATM)
• Pen input devices
• Light pens
• Touch sensitive screens
• Bar code scanners
Output DevicesOutput Devices
Display monitorsDisplay monitors
Liquid Crystal Displays (LCDs)Liquid Crystal Displays (LCDs)
Printers and plottersPrinters and plotters
Computer Output Microfilm (COM)Computer Output Microfilm (COM)
Software: OSSoftware: OS
The The operating systemoperating system (OS) is loaded from (OS) is loaded from secondary memory into main memory when secondary memory into main memory when the computer is turned on, and remains in the computer is turned on, and remains in memory until the computer is turned off.memory until the computer is turned off.
RAM DiskCPUCache
Bus
OS