Computer Science Theory - 1.1 Systems Architecture PDF

Summary

This document provides a lecture or study guide on computer science theory, focusing on 1.1 Systems Architecture. It covers topics from the basics of computer systems and CPU function to more advanced concepts in computer architecture. The document includes diagrams, examples, and questions.

Full Transcript

uth Chingford Foundation Sch Building ambition for all 1.1 Systems architecture The purpose of the CPU Objectives You will study:  The purpose of the CPU  The fetch-execute cycle Activity Com...

uth Chingford Foundation Sch Building ambition for all 1.1 Systems architecture The purpose of the CPU Objectives You will study:  The purpose of the CPU  The fetch-execute cycle Activity Computer systems Computer systems consist of hardware and software. Write three examples of hardware and software. Examples 1_______________________________________________ _ Hardware is the physical and visible 2_______________________________________________ components of a _ computer system. 3_______________________________________________ _ Software is a set of Ainstructions, computer system 1_______________________________________________ takes a set of inputs, processes them and creates a set of data or outputs. programsWrite usedtwo to examples_ of input and output devices. execute specific tasks. INPUT CPU 2_______________________________________________ OUTPUT _ (Processing) 1______________________ 1_______________________ 3_______________________________________________ 2______________________ _ _ Memory Notes The purpose of the CPU The Central Processing Unit (CPU) fetches and executes instructions that are stored in the (main) memory. Discussion Fixed-program computers  Early computers were designed to do specific tasks (e.g. compute the trajectory of artillery / break the German encrypted messages during WW2) and nothing else.  In order for the computers to perform a different task, they would have to be physically rewired or redesigned.  This meant that repurposing a computer was a difficult, expensive and time-consuming.  NOTE: This is not in the OCR specification but it is still important to understand how early computers worked. Notes Von Neumann Architecture  Von Neumann architecture was first published by John von Neumann in 1945.  It is based on the ‘stored-program’ concept, where data and program instructions are stored in the same memory.  This design is still used in most computers produced today. MEMORY 00 Load 20 01 Add 21 Program 02 Store 22 instructio 03 End ns 04 100 Dat 05 45 a 06 Notes Program instructions and data  Data and program instructions are stored as binary in the same memory.  It is not possible to tell if the binary represents program instructions or data by simply looking at it. MEMORY MEMORY 00 Load 20 000000 00000001 Program 01 Add 21 Program 00 00010100 instructio 02 Store 22 instructio 000000 00000100 ns ns 01 00010101 03 End 000000 00000000 04 100 10 00010110 Dat Dat 05 45 000000 00001000 a a 000000 00001000 06 11 11 Notes The fetch-execute cycle  The CPU executes program instructions through the fetch-execute cycle.  It is also referred to as the fetch-decode-execute cycle. FETCH instructio Fetch stage: The CPU fetches n an instruction from Random Access Memory (RAM). EXECUTE DECODE instructio Decode stage: The control unit instructio (CU) interprets the instruction. n n Execute stage:  The decoded instruction is executed.  The ALU (Arithmetic Logic Unit) is instructed to perform calculations if needed.  The process is repeated. 1.1 Systems architecture CPU components Objectives You will study:  Common CPU components and their function:  CU (Control Unit)  ALU (Arithmetic Logic Unit)  Registers  Cache  Von Neumann architecture:  PC (Program Counter)  MAR (Memory Address Register)  MDR (Memory Data Register)  Acc (Accumulator) Notes Terminology  Storage location - a place in RAM where a single piece of data is stored.  Address - a number assigned to a storage location in RAM so that it can be accessed. Notes Von Neumann Architecture CPU CPUs contains the following components:  Control Unit (CU).  Arithmetic Logic Unit (ALU).  Five registers (ACC Accumulator, MAR Memory Address Register, PC Program Counter , MDR Memory Data Register and CIR Current Instruction Register).  Cache (will be covered later). NOTE: The CIR is not part of the OCR specification, however, you can still  use it in your answers. Discussion What is this? Similar to how a brain has different regions that are responsible for different functions, the CPU has two main areas, the Control Unit and Arithmetic Logic Unit, that are responsible for different functions. Discussion What is the role of a conductor in an orchestra? Controlling the interpretation and pacing of the music using hand gestures and the aid of a baton. The Control Unit is comparable to the conductor of an orchestra, directing all of the different components of the CPU. Notes The Control Unit (CU)  It sends signals to direct the operations of the CPU.  It sends control and timing signals to other components (such as memory, storage, input and output devices, etc.).  It decodes the instructions.  NOTE: It is not required that you know how these control and timing Notes The Arithmetic Logic Unit (ALU) It performs:-  Arithmetic calculations (such as +, -, / and *).  Logical operations (such as AND, OR and NOT). Discussion What are these components called? Memory Memory Program Accumulat Data Address Counter or (ACC) Register Register (PC) (MDR) (MAR)  They are registers.  Registers are memory locations (unlike the CU and ALU). Notes Registers  A register is a small piece of memory that stores one instruction or address.  They are located within the CPU.  They include: 1.Program Counter (PC): It stores the address of the next instruction to be run. It increments during each fetch-execute cycle / each time an instruction is run. 2.Memory Address Register (MAR): It stores the address of the data or instruction currently being processed. 3.Memory Data Register (MDR): It stores the data or instruction that is fetched from memory. 4.Accumulator (ACC): It stores the results of arithmetic calculations (carried out by the ALU). Activity 1 - Registers Activity Match the register with the correct function. Program Stores the address of the Counter (PC) data or instruction being processed. Memory Data Stores the address of the next instruction to be run. Register (MDR) Memory Stores the results of Address arithmetic calculations Register (MAR) carried out by the ALU. Accumulator Stores the data or instruction that is fetched from memory. (ACC) Activity Activity 2 A: Tick (✓) the boxes to identify the registers. Register RAM Arithmetic Logic Unit (ALU) Memory Data Register (MDR) Program Counter (PC) Accumulator (ACC) Control Unit (CU) Memory Address Register (MAR) B: Tick (✓) the boxes to identify the components which are part of a CPU. Part of the CPU Control Unit (CU) Arithmetic Logic Unit (ALU) RAM Program Counter (PC) Input devices Accumulator (ACC) Memory Data Register (MDR) Memory Address Register (MAR) Output devices Activity Activity 2 C: Tick (✓) the boxes to identify the memory locations. Memory location RAM Arithmetic Logic Unit (ALU) Memory Data Register (MDR) Program Counter (PC) Accumulator (ACC) Control Unit (CU) Memory Address Register (MAR) D: Label the following diagram. CPU RAM Addres Data s 0 Load REGISTERS 20 1 Add 21 2 Store 22 3 End Cache 4 Activity Activity 2 E: Tick (✓) one box in each row to identify which function applies to which component. Memor Memor Arithmet Progra y Contro y Data ic Logic m Accumula Addres l Unit Registe Unit Counte tor (ACC) s (CU) r (ALU) r (PC) Registe Function (MDR) r (MAR) It stores the data or instruction that is read from memory. It stores the address of the data or instruction being processed. It sends signals to direct the operations of the CPU. It stores the result of arithmetic calculations (carried out by the ALU). It decodes the instructions. It performs arithmetic calculations. It stores the address of the next instruction to be run. It sends control and timing signals to other components. It performs logical operations. It increments during each fetch- 1.1 Systems architecture CPU performance Objectives You will study:  How common characteristics of CPUs affect their performance:  Clock speed  Number of Cores  Cache size Important The 3 Cs that affect CPU performance There are three main factors that affect CPU performance:  Clock speed  Number of Cores  Cache size Discussion CPU speed over the last 80 years Year Instructions per second Clock speed 1948 700 700 Hz 1978 5,000,000 (million) 5 MHz 1997 233,000,000 (million) 233 MHz 2000 1,000,000,000 (billion) 1 GHz 2012 4,000,000,000 (billion) 4 GHz There has been a significant improvement in clock speed since early computers. NOTE: This is not part of the OCR specification but it is still useful  to understand how clock speed has changed over time. Notes Clock speed  Clock speed is the number of cycles per second.  It is measured in GHz (Gigahertz).  The CPU executes a set number of instructions per each clock cycle.  1 Gigahertz (GHz) equals one billion cycles per second. What does a faster clock speed mean?  A faster clock speed means more cycles per second, therefore more instructions can be executed each second.  A faster clock speed means more tasks can be completed each second, so software is more responsive. Discussion Timeline of CPU clock speed Year Clock speed 1948 700 Hz 1978 5 MHz 1997 233 MHz 2000 1 GHz 2012 4 GHz What has happened to clock speed in the last 10 years?  It has stopped increasing.  Although clock speed has stopped increasing, there have been developments in other CPU characteristics (such as cache, multi-core, ARM instruction set, etc.). Discussion True or False? A 3GHz CPU will always out-perform a 2GHz CPU. This is false. A 3 GHz CPU does not necessarily out-perform a 2GHz CPU; there are other factors that need to be taken into consideration (such as number of cores, cache size, etc.). Important The 3 Cs that affect CPU performance There are three main factors that affect CPU performance:   Clock speed  Number of Cores  Cache size Notes Multi-core processors A multi-core processor contains more than one CPU. CU ACC PC CU ACC PC ALU MD MA ALU MD MA Each core has its R R R R own CU, ALU, Core 0 Core 1 registers, etc. Dual-core processor chip Common names: Number of Common names cores 1 Single-core 2 Dual-core 4 Quad-core 5 Penta-core 6 Hexa-core 8 Octa-core, Octo-core 10 Deca-core Example Examples 1 RAM RAM Addres Data Addres Data s s Load 20  Load 20  0 Load 0 Load Add 21 20  Add 21 20  1 Store 22 Add 21  1 Store 22 Add 21  2 End Store  2 End Store  22 22 3 End 3 End 4 4 Core Core Core 0 1 SINGLE-CORE DUAL-CORE Example Examples 2 RAM RAM Addres Data Addres Data s s Load 12  Load12  0 Load 0 Load12 Add 13 12  Add 13  1 Add 13 1 Add 14 Add 13  Add 14  2 Add 14 2 Add Add15 14  Add 15  3 Add 15 3 Store 16 Add 15  Store 16  4 Store 4 Load 18 Store  Load 18 16  Sub 16 19  5 Sub 19 Load  5 Store Load 20  Store 18 20  18 End End  6 Sub 19  6 Sub 19 7 Store 7 Store 20 20 8 End 8 End Core Core Core 0 1 SINGLE-CORE DUAL-CORE Example Examples 3 RAM RAM Addres Data Addres Data s s Load 12  Load12  0 Load 0 Load12 Add 13 12  Add 13  1 Add 13 1 Add 14 Add 13  Add 14  2 Add 14 2 Add Add15 14 Add 15  3 Add 15 3 Store 16 Add 15 Store 16  4 Store Load 18 Load 18  4 Store 16 Sub 16 19 Sub 19  5 Load 5 Store Load 20 Store 18 20  18 End End 6 Sub 19  6 Sub 19 7 Store 7 Store 20 20 8 End 8 End Core Core Core Core Core 0 1 2 3 SINGLE-CORE QUAD-CORE Notes How multi-core processors improve CPU performance  Multi-core processors allow parallel processing to take place, which means each processor can execute a separate instruction from the same program at the same time.  They can process instructions independently of each other, which enables multitasking. DUAL-CORE SINGLE-CORE PROCESSOR PROCESSOR Instruction 2 Instruction 1 Instruction 2 Instruction 1 Core 0 Core 1 Core Discussion True or False? A laptop with a quad-core processor will always run twice as fast than a laptop with a dual-core processor. This is not always true because:  Some software cannot be split between processors, so performance is not increased.  RAM size, clock speed and cache size also affect the Important The 3 Cs that affect CPU performance There are three main factors that affect CPU performance:   Clock speed   Number of Cores  Cache size Notes Cache  Cache is a high speed memory that stores the recently or frequently used instructions.  It is volatile and is located within the CPU itself or very close to it. Notes How cache affects CPU performance  It is faster to transfer instructions and data to and from cache than transferring to and from RAM.  A CPU can access instructions in cache faster than accessing them from RAM.  This is to do mainly with access time, not because cache is closer to the CPU than RAM. CPU RAM responds SL in 100 S O ES W nanoseconds C Cache FASTER ER A C TI A memory ACCESS M CC ER E E W TIM responds in 1 TIME ES O S S L nanoseconds Cache RAM NOTE: The response times of cache and RAM are only estimates and have been provided to help understand how cache improves CPU performance. Do not include the response times in your Notes How cache works 1. When the CPU tries to 2. If it is in cache, the fetch data, it first checks if it is in cache. CPU data is fetched from cache. 3. If it is not in cache, the CPU checks RAM for the data. ADD 21 Cache ADD 21 RAM Discussion Question Why don’t we increase the size of cache and get rid of RAM? Too much cache can be detrimental to CPU performance as it will take the CPU longer to find instructions. Secondly, cache is very expensive. Notes Multi-level cache  Most CPUs have multi-level cache.  Two-level cache:  L1 - is the smallest, fastest and closest to the CPU.  L2 - is larger and further from the CPU. It is slower than L1 but quicker than RAM. CPU Level 1 Cache Size Speed increas increas es es Level 2 Cache RAM (Main memory) Why does a CPU need multiple levels of cache? If cache is too big it can be detrimental to the performance of the CPU as it will take the CPU longer to find instructions. It is thus split Exam questions 1. The table has four components of a computer, and four statements. Tick (✓) one or more boxes in each row to identify which component(s) MAR each statement MDR describes. Cache PC It stores a single address. It stores frequently and recently used instructions. It is a register. It stores data or instructions fetched from RAM. 2. Explain why having a dual core processor might improve the performance of the computer. 3. Explain what happens during each stage of the fetch-execute cycle. Fetch: Decode: Activity Recap How it affects CPU What it is performance. A. Describe what is meant by clock speed. B. Tick one box to identify clock speed’s unit of measurement.  Gbps 1.  GHz Clock  Gb speed C. Tick one box to identify the number of cycles a 4.2 GHz processor can perform in a second.  4.2 billion  4.2 million  4.2 thousand Activity Recap How it affects CPU What it is performance. A. Describe what is meant by a multi-core processor. 2. Number of Cores B. Write the name of each CPU. 1 core: 4 cores: 5 cores: Activity Recap How it affects CPU What it is performance A. Describe what cache stores. 3. Cache size B. Describe where cache is located. Do Now activity Crack the car related codes A __ __ T O U __ __A__T__I __C __ __M P A __ K __ R __ N G I __ Y __ __ K P Q Y K OM Z __ D Y H U OWS A V N __ __ __ I__ G__A__T__I __ N __S Y__S__T__E__ O __ M__ __ W Y XO S Y K O PW B I B K C Q KEY Cipher A B C D E F G H I J K L Plain S E P R Y T M N O P Q R S T U V W X Y Z C I O M G K N V A U Do Now activity Computer systems that control cars Some examples of computer systems that control today’s cars. Rain-sensing Tyre pressure system Satellite monitoring navigation system (Sat Nav) Air Bag control Anti-Lock Braking System Automated (ABS) lights Automatic Parking Adaptive cruise control Engine control unit (Main system computer) These are all examples of embedded systems. 1.1 Systems architecture Embedded systems Objectives You will study:  The purpose and characteristics of embedded systems  Examples of embedded systems Notes Embedded systems Definition: An embedded system is a computer system built into another device. Characteristics of embedded systems:  Limited functions - they perform one or few functions.  Part of a larger machine - they fit into a device.  Single circuit board - They have a processor, memory, and input and output interfaces on a single circuit board.  Low power - they can operate from a small power source. Notes General-purpose systems vs. Embedded systems General-purpose system Embedded system It performs multiple functions. It performs one or few functions. It has multiple chips combined. It is a single chip. It is a self-contained system. It is part of a larger system. Examples: Examples:  Laptop  Washing machines  Desktop PC  Digital cameras  Tablet  Microwave ovens  Smartphone  Dishwashers  ATMs (Cash machines)  Calculators  Automated lights in cars  Satellite navigation system (Sat Nav)  Automatic Parking in cars  Air Bag control Discussion General-purpose system or Embedded system? Why? Digital camera Embedded system Discussion General-purpose system or Embedded system? Why? Smartphone General-purpose system Discussion General-purpose system or Embedded system? Why? Washing machine Embedded system Discussion General-purpose system or Embedded system? Why? ATM machine Embedded system Discussion General-purpose system or Embedded system? Why? Laptop General-purpose system Discussion General-purpose system or Embedded system? Why? Calculator Embedded system Activity Characteristics of Embedded systems Tick (✓) one box in each row to show whether each characteristic applies to embedded systems or general-purpose systems. General- Embedded Statement systems purpose systems It is a self-contained system. It is a single chip. It has multiple chips combined. It is part of a larger system. It performs one or few functions. It performs multiple functions. Exam questions 1. The table has four statements. Tick (✓) one box in each row to identify whether each statement is a characteristic of embedded systems or general-purpose systems. Embedded General-purpose system computer Has limited functions. Often built into a larger machine. Performs multiple functions. Has a microprocessor on a single circuit board. 2. A satellite navigation system (Sat Nav) contains an embedded system. Define what is meant by an ‘embedded system’. 3. Identify two devices, other than a Sat Nav, which contain embedded systems.

Use Quizgecko on...
Browser
Browser