> See also: > - [[Computers]] # Computer Processors A processor is a programable electrical circuit for executing math - The processor interacts with the main [[Computer Memory|memory or cache]] to fetch instructions and store results Control Unit Arithmetic Logic Unit (ALU) **Central Processing Units (CPUs)** are general purpose **Graphical Processing Units (GPUs)** excel at parallel processing **CPU** - Word processing - Running web servers **Either CPU/GPU** - Scientific computing applications - Parallel mathematic operations **Threads** within a CPU represent the smallest unit of execution within CPU cores. They are a ## General Processor Architecture - Cores - Threads - Clock Speed It’s important to have a clock signal within a CPU to allow for the synchronization of operations and to prevent potential data In computer architecture, a **hazard** is a condition that may prevent the next instruction from executing or completing its execution smoothly. | Type | Hazard | Description | | :------------- | :---------------------: | :------------------- | | **Data** | Read-After-Write (RAW) | | | | Write-After-Read (WAR) | what is it good for? | | | Write-After-Write (WAW) | | | **Control** | Branch | | | | Jump | | | **Structural** | Resource Hazard | | | | Memory Hazard | | | **Pipeline** | Pipeline Stall | | | | Pipeline Bubble | | | | | | ### Arithmetic Logic Unit (ALU) ![[Pasted image 20240307164214.png|400]] **Threads** within a CPU represent the smallest unit of execution within CPU cores. They are a ## General Processor Architecture - Cores - Threads - Clock Speed It’s important to have a clock signal within a CPU to allow for the synchronization of operations and to prevent potential data In computer architecture, a **hazard** is a condition that may prevent the next instruction from executing or completing its execution smoothly. | Type | Hazard | Description | | :------------- | :---------------------: | :------------------- | | **Data** | Read-After-Write (RAW) | | | | Write-After-Read (WAR) | what is it good for? | | | Write-After-Write (WAW) | | | **Control** | Branch | | | | Jump | | | **Structural** | Resource Hazard | | | | Memory Hazard | | | **Pipeline** | Pipeline Stall | | | | Pipeline Bubble | | | | | | ### Arithmetic Logic Unit (ALU) ![[Pasted image 20240307164214.png|400]] ### CPU Registers This is related to the 32-bit and 64-bit processor descriptions associated with modern computers ## CPU Processes While by default a CPU will only execute one process at a time, this isn’t a ## CPU Performance > **Basic Definitions of Performance** > Response Time: How long it takes to do a task > - a.k.a. Execution Time > - **My CPU:** AMD Ryzen 7 5800H - 8 Cores - 16 Threads - 4.463 GHz ### Measuring Execution Time **Elapsed Time vs CPU Time** Elapsed times provide the best measure of what the user actually experiences while waiting for a program to complete ### Clock Cycles Instead of reporting execution/response time in seconds, we often use **cycles**. ![[Pasted image 20231125080115.png|400]] $\text{CPU Time} = \text{CPU Clock Cycles } \cdot \text{Clock Cycle Time}$ A CPU with a clock speed of 4.4 GHz executres 3.2 billion cycles per second ### CPU Registers This is related to the 32-bit and 64-bit processor descriptions associated with modern computers ## CPU Performance > **Basic Definitions of Performance** > Response Time: How long it takes to do a task > - a.k.a. Execution Time > - **My CPU:** AMD Ryzen 7 5800H - 8 Cores - 16 Threads - 4.463 GHz ### Measuring Execution Time **Elapsed Time vs CPU Time** Elapsed times provide the best measure of what the user actually experiences while waiting for a program to complete ### Clock Cycles Instead of reporting execution/response time in seconds, we often use **cycles**. ![[Pasted image 20231125080115.png|400]] $\text{CPU Time} = \text{CPU Clock Cycles } \cdot \text{Clock Cycle Time}$ A CPU with a clock speed of 4.4 GHz executres 3.2 billion cycles per second **Cycles per instruction (CPI**) is the average number of clock cycles per instruction for a program or program fragment. ![[Pasted image 20231119132830.png|600]]