Reminder Items Flashcards
Program
A list of Instructions for a computer to execute
Data
Everything that is not an instr
What does it mean to run the program?
executing program code instruction after instruction)
Computer component that executes program?
CPU
Running Program is stored here, what else is stored there?
RAM stores currently running programs and data of a program
RAM
Random access means- it takes roughly the same amount of time to access a piece of data, no matter where this piece of data is stored physically on the memory device.
Volatile - once power supply is off all the data in RAM memory is erased.
Slow compared to the CPU.
Memory Stall
an undesirable scenario when CPU pauses and waits for the necessary data to be delivered from RAM memory.
Long-Term Storage?
Hard Disk- non volatile
Executable File
An executable file is a file that contains machine code or bytecode that can be directly executed by the computer’s CPU or an interpreter without needing further compilation.
How speed of CPU, RAM and hard disk compare to each other?
CPU, RAM Hard Disk fastest to slowest
Cache Memory
special device between CPU and RAM, at acts as a buffer for a slower, larger memory. Between the CPU and RAM
- Speeds up interactions between CPU and RAM.
ROM memory
READ-Only memory
a type of non-volatile memory that stores permanent data and instructions for a computer to start up and run.
Machine Cycle
sequence of steps that the CPU takes to execute one single instruction.
3 Steps Of Machine Cycle
Fetch command: retrieving next instruction from RAM memory and stores it in the program counter
Decoding: CPU decodes the instruction to determine what operation needs to be performed
Execution: CPU executes the instruction
What Frequency measures? What is the measurement unit of frequency?
(Hz = times/second)
Measures CPU frequency or clock rate. How many cycles per second
CPU Clock
a device (hardware) that issues synchronization pauses for all other CPU components.
When pause arrives, each component does one unit of WORK.
CPU Frequency
CPU frequency is clock speed, measures how many cycles CPU can complete in one second.
Cycles/ seconds
CPU Core
little CPU, each one is an individual processor.
our cores, allowing it to process four tasks (or threads) at the same time. (can boost performance w/ apps that are designed to utilize multiple CPU cores)
How does memory look like
linear array of bytes
What is byte? What is bit? How many bits are in a byte?
BYTE- 8 bits
Bit - Binary Digit in base 2 (either 0/1) they are components of info
Memory Address
Specific bytes that refer to a specific place in RAM
What is the memory address of a larger chunk of memory?
Typically expressed in hexadecimal
Length of memory address
2^n where n= length of memory address
How long should be memory addresses to address a given amount of memory?
log2 ( N) where n- given amount of memory in bytes
Can memory contain nothing
NO, when the computer is powered on RAM stores information to prepare it for use.
What is the relationship between C++ variable, RAM and memory address?
Variables are a high level construct that allows us to deal with RAM.
After compilation variables disappear from the program and turn into memory addresses that refer to a specific place in RAM.
C++ pointer
a variable that stores the memory address of another variable
C++ data types: char, short, int, long, long long, float, double? Does signed/unsigned affect those sizes (for example, is the size of int, signed int, and unsigned int equal)?
char: 1 byte (8 bits)
short: 2 bytes
int: 4 bytes (32 bits)
long: 4 bytes (32 bits)
long long: 8 bytes
float: 4 bytes (32 bits)
double: 8 bytes
Signed or unsigned does not effect size they are EQUAL.
Hexadecimal numbers. Why do we use them? How to convert from hexadecimal to binary and back quickly?
A9
1010 1001
This is because memory is typically organized in byte-addressable units, and each hexadecimal digit represents four bits
Word
is the amount of data that a computer can deal with in one operation. (usually mean 4 bytes)
PC
Program Counter- stores the address of the next instruction to be executed
language that the CPU understands
Machine Language -consists of binary instructions.
How can we execute program written in higher-level languages?
High-level programming languages (e.g., C++, Python, Java) are translated into machine language via a compiler or interpreter, allowing the CPU to execute those instructions directly.
Compiler
translates high level code into machine language through a final executable file. The executable can be ran over and over again.
Advantage - creates faster programs. Translates the entire program into machine code before execution begins. Once the program is compiled, the CPU can execute the machine code directly without any further translation.
Disadvanatge: Platform specific to the type of system arch.
Languages: C++, C, Rust
Interpreter
An interpreter is a type of program that translates and executes code line-by-line rather than translating the entire program at once like a compiler. It reads a high-level programming language (e.g., Python, Ruby, JavaScript), converts each line into machine code, and executes it immediately.
Advantage: Platform Independence
Disadvantage: Programs generally run slower because translation happens every time the program is executed, rather than just once. Plus its needed every time code Is ran.
Interpreted languages: JS, Python, Java, C#