Architectures and Operating Systems Flashcards
List memory technologies charateristics:
Static RAM (SRAM):
Access Time: 0.5ns – 2.5ns Cost: $500 – $1000 per GB
Dynamic RAM (DRAM):
Access Time: 50ns – 70ns Cost: $10 – $20 per GB
Flash Superconductor Memory:
Access Time: 5,000ns – 50,000ns Cost: $0.75 – $1 per GB
Magnetic Disk:
Access Time: 5,000,000ns – 20,000,000ns Cost: $0.05 – $0.1 per GB
Ideal Memory:
Access Time: Same as SRAM Capacity and Cost: Same as disk
The price decreases as you go down whereas the speed increases as you go up.
What is Cache?
What is cache hit?
A cache hit occurs when the data requested by the CPU is found in the cache, resulting in faster data access.
What is cache miss?
A cache miss occurs when the requested data is not found in the cache, requiring the system to retrieve it from a slower memory level
Formula for hit rate?
Hit rate = number of cache hits/total number of memory accesses *100
Formula for miss rate?
Miss rate = 1 - hit rate
or
Miss rate = number of cache misses/total number of memory accesses * 100
How can you measure cache performace?
AMAT (Average memory access time)
Formula for AMAT?
AMAT = hit time + (miss rate * miss penalty)
A lower AMAT indicates better cache performance.
What is miss penalty?
Miss penalty is the extra time required to fetch data from a lower memory level (like main memory) after a cache miss, including data retrieval and cache update time. At least 10 of clock cycles.
Solve this problem:
Say hit rate is 98%, hit time is one clock cycle and the miss penalty is
50 clock cycles. What is AMAT?
AMAT = hit time + (miss rate * miss penalty)
AMAT = 1 (always 1) +( 0.02 (100-98/100) * 50) = 2
What are the two types of locality that improve cache performance?
Temporal Locality: Recently accessed items are likely to be accessed again soon. Instructions within a loop or frequently accessed variables.
Spatial Locality: Items near recently accessed data are likely to be accessed soon. Sequential instructions or array elements accessed in order.
What is direct mapping?
Direct mapping assigns each memory location to exactly one cache block based on the index calculated using modulo division:
Cache Index=Memory Address mod 2k
where k is the number of index bits.
What is hit time?
Hit time is the time required to access data from the cache, including the time to check the cache tags and retrieve the data. Usually 1-3 clock cycles.
What is a fully associative cache?
A fully associative cache allows any memory address to be placed in any cache block. It requires checking all cache tags for a match, which increases complexity and cost.
What is a set associative cache?
A set associative cache divides the cache into multiple sets, each containing a fixed number of blocks. A memory address maps to a specific set, and data can be placed in any block within that set.