1/49
A set of flashcards covering key concepts related to cache memory, multitasking, and various technical definitions discussed in the lecture.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Why is cache memory needed?
Cache memory is needed because the CPU is faster than main memory, causing delays.
What problem does cache solve?
Cache reduces CPU waiting time for data.
What is cache memory?
Cache memory is a small, fast temporary storage located between the CPU and main memory.
What does cache store?
Cache stores recently used data.
What is temporal locality?
Temporal locality refers to the concept that recently used data will likely be used again.
Example of temporal locality?
An example of temporal locality is the repeated use of a variable like 'sum'.
What is spatial locality?
Spatial locality is the principle that nearby memory addresses are likely to be accessed.
Example of spatial locality?
An example of spatial locality is accessing array[i], array[i+1], array[i+2].
Memory hierarchy (fast to slow)?
The memory hierarchy from fast to slow is: Registers, Cache, RAM, Flash, Storage.
What happens as memory size increases?
As memory size increases, it generally becomes slower.
What is a direct-mapped cache?
A direct-mapped cache is a type of cache where each memory block maps to one specific cache location.
Main advantage of direct-mapped cache?
The main advantage of direct-mapped cache is its very fast lookup.
Main disadvantage of direct-mapped cache?
The main disadvantage of direct-mapped cache is conflict misses.
What is stored in a cache entry?
A cache entry stores a valid bit, tag, and data block.
Cache index formula?
The cache index formula is block number mod number of cache blocks.
What is a conflict miss?
A conflict miss occurs when multiple blocks map to the same cache index.
Address breakdown?
The address breakdown consists of a tag, index, and offset.
What is the offset?
The offset selects a byte inside a block.
What is the index?
The index selects a cache block.
What is the tag?
The tag identifies which memory block is stored in the cache.
How many bits for 4096 bytes of memory?
For 4096 bytes of memory, it requires 12 bits.
Offset bits for 16-byte block?
The offset bits for a 16-byte block are 4 bits.
Number of cache blocks (256B cache, 16B block)?
There are 16 cache blocks if the cache is 256B and the block size is 16B.
Index bits for 16 blocks?
The index bits required for 16 blocks are 4 bits.
Tag bits (12 total, 4 index, 4 offset)?
The tag bits needed are 4 bits.
What is a cache hit?
A cache hit occurs when the valid bit is 1 and the tag matches.
What is a cache miss?
A cache miss occurs when there is an invalid bit or tag mismatch.
What happens on a miss?
On a miss, the data is fetched from memory and the cache entry is replaced.
Types of cache misses?
The types of cache misses are compulsory, conflict, and capacity misses.
Hit rate formula?
The hit rate formula is hits divided by total accesses.
Effect of larger block size?
A larger block size improves spatial locality but can create more conflicts.
Effect of larger cache size?
A larger cache size typically results in a higher hit rate but is more costly.
What is a capacity miss?
A capacity miss occurs when the cache is too small to hold the required data.
Modern CPUs use what type of cache?
Modern CPUs use multi-level caches (L1, L2, L3).
What is a matrix keypad?
A matrix keypad is a grid of buttons organized using rows and columns.
How many keys does a 4 by 4 keypad have?
A 4 by 4 keypad has 16 keys.
Pins needed for 4 by 4 keypad?
A 4 by 4 keypad requires 8 pins.
How is a key detected?
A key is detected when it connects a row to a column upon being pressed.
Why use pull-up resistors?
Pull-up resistors are used to prevent floating inputs and noise.
What does OpenOCD do?
OpenOCD is a tool used to debug and program microcontrollers.
Execution time formula?
The execution time formula is cycles divided by CPU frequency.
Clock period formula?
The clock period formula is 1 divided by frequency.
What is DWT_CYCCNT?
DWT_CYCCNT is a cycle counter for measuring execution time.
How to measure execution time with DWT?
To measure execution time with DWT, read the counter before and after the operation, then subtract.
Why is precise timing important?
Precise timing is important to meet real-time constraints.
HAL vs Register performance?
Register-level performance is faster compared to HAL.
What is multitasking?
Multitasking is the ability to run multiple tasks via scheduling.
Are tasks truly parallel on STM32?
No, tasks are not truly parallel on STM32; it is a single core that switches between tasks.
Task states?
The task states are running, ready, blocked, and suspended.
What is priority inversion?
Priority inversion occurs when a high-priority task is blocked by a lower-priority task.