3.2 Computer Architecture By: Jamie Gordon. What is computer architecture? Computer Architecture...

86
3.2 Computer Architecture By: Jamie Gordon

Transcript of 3.2 Computer Architecture By: Jamie Gordon. What is computer architecture? Computer Architecture...

3.2 Computer ArchitectureBy: Jamie Gordon

What is computer architecture?

Click icon to add picture

Computer Architecture refers to the logical layout and relationships between the different computers of a computer system.

Computer System Fundamentals

• Fundamental architecture of a computer system shows the relationship between the different components of the system.

Inputi.e. keyboard

Process

Outputi.e. screen

THE CPU3.2.1

The Central Processing Unit

• The engine of the computer• AKA chip or processor• The CPU is broken up into parts:– Control Unit (CU)– Arithmetic Logic Unit (ALU)– Two communication bus systems:• Primary memory bus• Address bus

CPU Parts

• Control Unit (CU) – controls sequence of execution of programs in the computer’s memory

• Arithmetic Logic Unit (ALU) – performs logical operations (comparisons, math)

Additional Parts

• Data bus:– Connected to the memory of the computer– Moves data around the CPU– Used by CU to move data in and out of the CPU

• Memory Address bus:– Connected to the address section of the

computer’s memory– Accesses memory addresses (CU uses this)

Memory

• Each item of data or program instruction is stored in binary in a memory location

• Each memory location has its own unique address

MEANING OF TERMS BIT (B) AND BYTE (B)

3.2.2

Computers as Binary Devices

• Computers operate by storing data and instructions as sequences of 1’s & 0’s

• Bit refers to an individual 1 or 0– Represented by b

• Byte refers to a standard grouping of 8 bits– Ex. A letter is stored in 1 byte– Represented by B

• One byte being 8b is used for file sizes on a disk

PrefixesTerm Size

Tera (T) 1,000,000,000,000

Giga (G) 100,000,000

Mega (M) 1,000,000

Kilo (k) 1,000

8Mb = 8,000,000 bits8MB = 8,000,000 bytes or 64,000,000 bits

Precision of Prefixes

Standard• In SI units, terms are in

the standard decimal system

• Example:– 1km = 1 kilometer– 1km = 1000m

Computing• Measurements are

abbreviated– Ex. 1KB = 1024 (210) bytes

• However, 1KB is used as an approximation for 1000 bytes

THE TERMS WORD, REGISTER, AND ADDRESS AND THEIR USE IN THE STORAGE OF DATA AND INSTRUCTIONS

3.2.3

Stored Program Concept

• John von Neumann is credited with the concept that program instructions can be coded and stored together in memory with coded data1

• Why is this significant?– The ability to store and change programs in

computer memory allows a computer to become a general-purpose device

2 However, his “landmark paper” was simply an amalgamation of the work of others, such as J. Presper Eckhart Jr. and John Mauchly (not important)

Definitions• CPU generally works with a fixed number of

bits, typically a multiple of 8 (one byte)• This is known as a word• Register – temporary storage locations capable

of holding a word• Confused?– Ex. “Most” PCs have 32-bit processors

• Word size is 4 bytes (32 bits)• Registers will each hold 32 bits• The memory will also hold 32-bit data items• If a larger size is required, then multiple successive

memory locations will be used

Registers

• Registers are needed to hold addresses of instructions and data

• They are also needed to hold the instructions and data

• Therefore, the register size determines how much primary memory a computer can have

MACHINE INSTRUCTION CYCLE

3.2.4

The Cycle Itself•When a program is stored as a series of instructions in machine code in primary memory, these steps are carried out:•(This model is simple compared with real operation)

StartFetch instruction from

memory to control unit

Decode instruction in control unit

Execute instruction (data may be fetched from

memory)

Store results of execution (if any). Check for next

instruction.Stop

done

Mor

e to

do

PRIMARY MEMORY AND SECONDARY MEMORY (STORAGE)

3.2.5

Primary Memory

• Used by the computer to store running programs and the data used by these programs

• Instructions and data are represented as binary machine code in 1’s and 0’s in memory

• This is done electronically by using a constant voltage to indicate 0 and a higher voltage to represent 1.

Areas of Primary Memory

Random Access Memory (RAM)

• Enables programs and data to be loaded for use

• Can be over-written• Is therefore used for

general purpose storage• Voltage must be

maintained as lost power means lost data

• A.K.A. volatile or short term memory

Read Only Memory (ROM)• Used to store programs

permanently– i.e. Operating System

• Cannot be changed• A.K.A. non-volatile

memory

Cache Memory

• Two main types of RAM:– Fast dynamic RAM (DRAM)– Even faster static RAM (SRAM)

• More expense and is not used for all of the IAS4

• However, it is used in between main RAM and the processor as temporary storage for program instructions

• When the processor has to look for next instruction it is typically in the cache

• Modern processors also have internal cache, making it even faster

• Level 1: microprocessor itself• Level 2: between primary memory and processor• Typically measured in MB54 The book does not bother to explain what this is 5 Apparently

Virtual Memory

• Primary memory may not be large enough for the whole program to hold at once

• Various methods can be used to solve this problem, but the only one you NEED to know is that the hard drive can be used as an extension of primary memory

• This area is known as a swap file

SECONDARY MEMORY, SEQUENTIAL AND DIRECT ACCESS

3.2.6

Secondary Memory

• Permanent memory storage– i.e. disks and tape6

• Data stored in primary memory must be move to secondary memory for permanent storage (again, data is lost if power is lost)

• “Backing storage” is required to keep information which isn’t used all the time and might be too big for the memory

• Programs and data are held on “backing storage”

6 For more recent examples think CDs, DVDs, and flash drives

Ways of Storing Data

Sequential-Access• Accessing one data

record at a time• One after another• Example:

– Payroll program has to access data files containing all data on a company’s employees

Direct-Access• A.K.A. random access• Computer locates an

item quickly by moving directly to its record

• Example:– Supermarket were on

sale item’s details are held in a file

MAGNETIC TAPE!!!!!!!!!!!!!!

• Serial-access7 medium• Typical magnetic tape might be 2400ft in

length and ½in. wide• Modern versions are more compact8 tape

cartridges and store several GB of data• Used for backing up large amounts of data• No new systems use tape! :P

8 2x the size of a cassette

Tape is Stored in Parallel Tracks• A bit can be stored in each track• 1 byte per frame• Diagram shows a 9-track tape (others are available)• A basic unit of data transfer is a byte• The remaining track10 is a parity track

1

2

3

4

5

6

7

8

P

TracksInter-block gap Frame

Parity trackTape Movement

10 not usually located on the edge of the tape

Tape Storage

• When a byte is written to the tape the number of 1’s are counted

• The parity bit then is used to make this number even (even parity) or odd (odd parity)

• When the tape is read again, the parity bit is checked to see if an odd bit has been lost somewhere

1 2 3 4 5 6 7 8 P

0 1 1 0 1 0 0 1 Odd 1

0 1 1 0 1 0 0 1 Even 0

1 0 0 0 1 1 1 1 Even 1

Tapes, etc.

• To avoid errors, the speed of the tape drive must be very steady• It does take time for the tape to get up to speed, so data is

written in blocks separated by inter-block gaps (like on the diagram)

• Smaller tapes are used for microcomputers to back up information from fixed disc packs11

• Tape streamers are used in microcomputers (PCs) because they are very efficient

• Typical tape cartridges could be used as they can store several hundred GB

• Serial access using tapes can be disadvantageous because of its speed

11 whatever that is

Analogies

• You can compare serial access and direct access by using a musical analogy:– Serial (Sequential): To find a given song on a

tape you must wind through all the tracks – Direct: With a CD player you can directly select

the piece you want

¡MAGNETICOS DISCOS!

Floppy Disks• Typically 1.5MB

Fixed (Hard) Disks• Typically 100GB12

12 “These things change quickly, of course”

Mainframe Disk Pack• Several hundred GB

Hard Disc(k)

• A hard disk consists of several plates of magnetic material arranged on a single spindle

Disks

Cylinder

Spindle

Read/write heads

Disk Surface Terminology (HL)

• The surface of a disk is divided into sectors and tracks• A floppy disk has 10 sectors and 8 tracks.• A hard disk may have several hundred tracks on each surface or side

SectorTracks

Disk Assemblies• Cylinder – the common arm that all read/write heads are attached to so that they are all reading the same track and sector on each surface• Block – the unique combination of a surface, sector, and track number which is used to reference a disk pack• Bucket Size – transference of several blocks of data from disk to Immediate Access Store (memory) at one time• Because each block has a unique address, it is possible to store the addresses of files, and their sizes, in a catalogue on the disk

• Data or programs can be retrieved by looking up the addresses in the catalogue

Spindle

cylinder

Optical Disks!?!?!?!?!?

• DVD and CD ROMs are related technology• The CD ROM in your PC is the same as those for music, but data is

stored differently• The surface of a CD has plateaus and ditches which can represent

binary states• These small irregularities are read by a LAZER• CDs are useful for distributing information because they are portable

and rugged14

• There are also CD-Rs (recordable) on the market which can be written once but read multiple times (Write Once Read Many [WORM])

• There are also CD-RWs which can be used like large floppy disks• These compete with magnetic media like ZIP disks which typically

hold a few hundred MB14 Unlike floppy disks which are weak and frail. They are also unlike floppy disks in that they can record from 600MB per CD to 2.7GB per DVD.

Sequential (Serial) Access

• Sequential file access (in case you forgot) means that data records cannot be accessed without references to other records in a file

• The logical order of the records is important in terms of access

• In a sequential file records are usually sorted according to the primary key’s value

• A serial file has a sequential organization in that the records must be searched in a linear manner, but the records are not sorted

Direct File Access

• Much faster because data records can be retrieved by specifying the record’s position without referencing other records

• The file management system can then identify the track and sector position and directly access the data by position the read arm of the disk in the appropriate way

• The logical order is unimportant, i.e. records can be in a completely random order

• Hence the term random access file

Examples

• In both cases, the key field required is called a primary key which is used to indentify the record• In direct access it is necessary to be able to link this primary key to the record number

0 1 2 3 4 5 6 7 8 9 10

Sequential AccessStart byte Read though bytes

0 to 5

Read byte 6

0 1 2 3 4 5 6 7 8 9 10

Direct AccessStart byte

Seek to read byte 6 without reading bytes 0 to 5

Advantages, Disadvantages and Applications of Sequential

Access• Sequential file access is used to store data that is

normally processed in the order that it is stored– Example: a set of temperature data is normally only

processed from start to finish and it isn't often necessary to access an individual record

• The key advantage is that it is simple to organize and there are few processing overheads and can be written either to a disk or a tape

• The main disadvantage is that interactive or online processing isn’t possible because of slow access times

Advantages, Disadvantages and Applications of Direct Access

• Direct access files are used where high speed access is required– Example: a large bank would store data on customers in this

way in order and to ensure that data could be retrieved quickly, the customer’s bank account number would be used as the primary key

• The key advantage is that records can be accessed quickly (again).

• The main disadvantage is that data cannot be accessed in sequential or sorted order as records are place randomly on the disk. It is only possible to implement on disk technology and not tape.

Break Time!

MICROPROCESSORS3.2.7

Huh?

• A microprocessor is a device which is of similar design to a CPU but without large amounts of primary memory

• It has a single program stored in non-volatile memory (ROM)and a number of registers for volatile storage (RAM)

• It is similar to a computer but without the ability to change its programming

Examples of UseObject Function(s) of a microprocessor

Car Controlling fuel injection to the engine; automated braking systems, airbag controls; GPS; automatic car washes;

Washing Machine Controlling water level, temp., wash time, spin speed.

Camera Controlling exposure time, autofocus calculations; conversion of image to storage as a file (digital)

Video Tape player (VCR)

Timing, programming, station selection

CD Player Track select; extracting time & other details; conversion from optical to electrical

House TV with remote; TV with teletext(?); central heating & air conditioning control; digital clocks; microwaves; dishwashers; printers; computer ports (USB, printer, modem); burglar alarms; mobile telephone

Classroom Calculators; digital watches; airconditioning or heating; security

Microcontrollers

• Microprocessors are often used for similar task and may have a standard set of input and output ports for analog data.

INPUT DEVICES3.2.8

Fundamental Roles

• Input devices are used to enter data into a computer system

• Used by humans to input data (keyboard)• Can be directly connected to a computer (barcode

reader)• Acts as the connection between the “internal

electronic world of the computer and the external world from whence the input comes”15

• An input device must be able to be interfaced (connected) to the computer and be used by a human

15 you and the computer

Input Process

Human or data collection

Interface between human and device (keyboard)

Input device

Processing Unit

Interface between input device and the processing unit

List of Different Input Devices

Keyboard

• A series of switches which generate a series of different pulse codes so that the computer knows which one was pressed

• Useful for typing in text (ergonomic keyboards used for comfort and to prevent injury)

• Keyboards also feature short cut keys to speed up common operations

Mouse

• The movement generates a series of pulses so that the computer knows which direction the mouse moved

• This is used to move a pointer on a screen in a GUI

• This type of environment is called a WIMP environment (Windows, Icons, Menus [Mouse], Pointers [Pull-down Menus])

Graphics Tablet

• A kind of flat board which a pen is moved on• The pen contains a magnet and the tablet is a

fine grid of wires• Movements of the pen causes disturbances in

the electrical pulses of the wires and the coordinates of the pen can be detected through these disturbances

• It is used for art programs or video-editing systems

Light Pen• Used to point to areas on a screen• Works by detecting the light emitted

by the TV• TVs and monitors work by directing a

beam of electrons onto a fluorescent surface

• Performs a regular scan, starting in the top left-hand corner and travelling in closely space lines downward

• All of this happens to fast for us to see but the beam passes a given spot at a certain time which can be calculated from knowledge of the beam’s speed and the number of lines on the screen

• This type of light pen can be used to return a position

• Drawing programs and CAD (Computer-Aided Design) applications

• Seen in shops• Emits a light beam and

detects the amount of light reflected

• Dark areas reflect less, light areas more

• A sensor detects the amount of reflected light

• As the beam passes light areas reflect more than the dark bars, giving a stronger pulse

• Used for barcodes• Supermarkets typically use a

laser scanner which is fixed to speed up the process

Light Pen #2

Light beam

Source

Detector

Light Pen

Dark DarkLight Light

Optical Mark Recognition (Mark Sensing)

• Uses techniques of the light pen to detect black marks on white paper

• A common application is a scantron

Optical Character Recognition

• The principle of using reflected light is used for scanners, fax machines, and OCR (^)

• The scanner passes a beam of light over a page and measure reflected light (got it?)

• This gives a two-dimensional pattern of light and dark which be represented in binary

• You can then send this binary pattern by electrical pulses to a fax or import them to a computer

• With OCR you can try to match the binary patters to patterns stored in the computer’s memory and each recognized character is assigned to its standard code (ASCII)

OCR: A depiction

OCRSignal

Scan Line

Source Detector

Magnetic Ink Character Recognition (MICR)

• The “funny-looking” numbers at the bottom of a check are encoded in magnetic ink for use with MICR readers at a bank

• Some banks prefer MICR because of the speed and extra security above OCR

• However, MICR is more expensive than OCR• When the check is received by the bank the

amount must be encoded in the blank space on the right before processing

Automatic Data Entry

• Scanning and reading techniques above can be grouped as direct data entry16

• Automatic data entry occurs when a sensing device is permanently connected to a computer and the computer receives data from such a device at certain intervals

• Sensors are used to collect data when processes are automated (car washes, heating control, petrol delivery)

• These processes may be controlled with microprocessors

16 not to be confused with automatic data entry.

Digital Cameras

• Fairly common due to low prices and increasingly good quality

• Can be used with a monitor for video conferencing or simply taking photographs for web pages

• Usually, there is some form of data compression for storage and transmission in order to save space and decrease transmission time

• Common standard is JPEG (Joint Photographic Experts Group)

Speech Recognition

• Application digitally records speech and attempts to match it with known patterns

• Because of the wide variety of speech tones, accents, and pitches each individual must first “train” the application with a standard set of words

• The accuracy is said to be at about 90% for dictation for a word processor

Robotics

• Typically pieces of industrial machinery used in dangerous or tedious, repetitive17

tasks• Robot = programmable machine

17 The irony is not lost on me

OUTPUT DEVICES3.2.8

Output cont’d

• Used to “link the world of the computer” to ourselves or other computers through a communications channel

• A number of devices can act as both and input and output device (i.e. touch screen)

Output Process

Processor Unit

Output device

Interface

Human

Other Device

Video Display Unit or Monitor

• A VDU is like a TV screen but with a higher resolution• Terminal – culmination of VDU and keyboard• A typical mainframe computer will have “very many such”

terminals connected to it• On a PC the VDU is known as a monitor• Monochromatic or polychromatic• The definition or resolution of a VDU is a function of the number of

picture elements or pixels• Each pixel requires a memory location to store information about

its state (color). Polychromatic requires more• Very high resolution monitors (Graphical Display Terminals [GDUs])

might be used in special applications like cartography, commercial graphics, or design work

LCD• Liquid Crystal Display is found on small computers like Palm

Pilots or PDAs• Because these screens don’t perform well in lowlight, they are

backlit• They consume very small amounts of power compare to

conventional displays• Laptops have both passive and active LCD screens

– Active types have one charge controller (color) per pixel giving a brighter and sharper display

• Other advantages– Lighter– Flatter– Thinner– No radiation

• Replacing conventional CRTs on desktops

Printers

• May be classified by:– Amount of text, i.e. characters by line or lines

by page– Character formation: matrix vs. non-matrix– Method of printing: impact vs. non-impact– Color

Dot-Matrix• Used to be the cheapest option until inkjet

printers outperformed and outpriced them• Can still be found on low-volume systems• They are character, impact, matrix printers• Each character is produced by a set of pins

punching an inked ribbon onto the page• Lowest quality are 9-pin• Typical printing speeds are 50-200 chars

per second• Still used for small businesses for printing

credit cards and other receipts

Daisy Wheel

• Work like old-fashioned typewriters• Better quality than dot-matrix but the

character set is fixed• Non-matrix so graphical output is impossible• This type of printer is rare• Good quality is now obtainable by other

printers at comparative or lower price without the noisiness of a daisy wheel

Lineprinter

• Typically is based on a similar concept to the daisy wheel

• However there is a solid character for each position across the page and therefore the print-head does not move

• Since they print 1 whole line at a time they are much faster than character printers

Inkjet Printers

• Hold a cartridge of ink which is sprayed onto the page in small dots

• Matrix printer• The dots form characters• The ink is liquid so it spreads on the page

and creates a smoother appearance than a dot-matrix

• Color versions are available

Laser Printers

• Print a page at a time using a whole-page matrix of dots, very similar to photocopiers

• A lazer creates very small dots of small dots of static charge on the paper and powdered toner (ink) is attracted to these areas

• The paper is then heated and the toner melts onto the page

• High quality and color versions are more increasingly affordable

Plotters

• Two types:– Electrostatic

• Available in b-w and color• Make an image by burning special paper with a small

spark

– Pen Plotters• Hold a cartridge of several pens of different colors and

actually draw onto paper• Higher quality

• Able to plot onto large sheets which can be on a fixed size (flatbed) or on a large roll (drum)

Touch Screen

• Used as input and output• Options can be shown with text or graphics• Used where general information is being

provided (banks, hotels, shopping)• Users who may not be competent

RECENT DEVELOPMENTS IN COMPUTER SYSTEM ARCHITECTURE

3.2.9

Covers:

• Processor architecture• Memory technologies• Secondary storage devices• Data communications

Processor Architecture

• Architecture in which a single instruction is fetched into the CPU, decoded, and executed “von Neumann”

• John von Neumann first described it• Can be restrictive due to the von Neumann

bottleneck - (more efficient to have a single task performed by many [it if it can be split])

Recent Developments

• Single and Multiple pipeline• Single:

– An instruction can be fetched and another decoded while the first is still executing

• Multiple:– Pipelines word in parallel to increase the rate of processing of

instructions further• A similar idea is to use multiple processors in parallel, but

in both cases additional coordination is needed in case one instruction depends upon the results of another

• Supercomputers and mainframe computers extensively use multiple processors to share workload such as in Deep Blue and the Cray T3E

Primary Memory Technologies

• Review RAM• ROM cannot be written to except by a

special machine (blower)• Early development for testing of programs

stored in ROM was the EPROM (Erasable Programmable ROM). These can be recognized by a quartz window on top which can erase all memory if a UV light is shined through it

Recent Developments

• With rapid advances in modem and other technologies there was a need for upgradable ROM within the component itself

• So, Flash ROM is inserted into newer devices where the program can be changed by downloading suitable software

Secondary Storage Devices

• Remember: ZIP and CD-RW (100MB-3GB)• Smart media• Compact Flash• Memory Stick• Multimedia Card

– Non-volatile memory– Small– Low power consumption– Ideal for small portable devices

• “Typical” sizes range up to 64Mb on a card (~2x physical size of postage stamp)

• Rewritable flash memories are now common, typically in 128MB and 256MB– Small– Robust– Easily connected to USB ports– May contain executable code as well

Data Communications

• The mobile phone– Web browsing– Email reading– WAP (Wireless Applications Protocol) is expected to improve the

amount of data which can be transferred to a mobile phone (company intranets and VPNs [Virtual Private Networks])

• PDA (Palm Top or Personal Digital Assistant)– Stores contacts– Synchronizable with PC

• “Probably these two devices will converge”• Supplemented by ever faster backbones (systems for

transmitting data in networks) as well as ATM (asynchronous transmission) via cable modems (~30x faster than a 56k modem)

Further Resources

• Read about recent developments in technology– Try computer magazines and technical websites

• IB will not ask about specific technologies (except Case Study)

• Typical type of question on this topic is:– Outline any two recent developments in processor

architecture which have improved the speed at which programs can execute [4 marks]

• “Then you are free to briefly describe any two that you happened to have read about”

• No details, think about for extended essay

Websites• More detail on processor architecture can be fount at pages by John Morris of The

University of Western Australia:– http://ciips.ee.uwa.edu.au/~morris/CA406/pipelies.html

• Deep Blue (Parallel chess-player):– http://researchweb.watson.ibm.com/deepblue/meet/html/d.3.2.html

• Supercomputers and their applications:– http://www.cray.com/supercomputing– Cray’s Customers include:

• Department of Defense Naval Oceanographic Office– http://www.navo.navy.mil/

• Electronic Data Systems– http://www.eds.com/

• NASA’s Goddard Space Flight Center– http://www.gsfc.nasa.gov/

• United Kingdom Metrological Office– http://www.met-office.gov.uk/research/nwp/numerical/computers/index.html

• NOAA High Performance Computer Center– http://www.hpcc.noaa.gov/

• Great Information on hardware topics:– http://www.hardwarecentral.com/hardwarecentral/tutorials

• Since information may have changed, look for updates at:– http://www.ib-computing.com/