caching Flashcards

1
Q

cold storage

A

data not accessed frequently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is an example of something that would be stored on cold storage

A

backup data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

hard disk

A

rotating and magnetic
usually used for hard storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

solid state drive

A

flash memory with fast access times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what type of memory are disks

A

non volatile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

network file system

A

remote server/cloud based storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what type of memory is ram

A

volatile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how is ram packaged

A

as a chip

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what are the 2 types of ram

A

static and dynamic
sram dram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

sram

A

shorter access time
has 6x more transistors to store bits than dram making it more expensive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

dram

A

usually used as memory on personal devices as its cheaper than sram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

registers

A

v small on chip memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the issue with the cpu memory gap

A

cpu speed gets bottlenecked by memory speed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is the cpu memory gap

A

cpu speed is increasing faster than memory access time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

cache

A

a smaller faster storage device that acts as a staging area for a subset of data in a larger slower device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is the goal of cache

A

achieve access speeds of the fastest memory whilst paying the cost of the cheapest

17
Q

locality principle

A

accessing a small localised subset of memory

18
Q

temporal locality

A

recently accessed data likely to be accessed again in the near future

19
Q

spacial locality

A

data near recently accessed addresses likely to be accessed

20
Q

how do we exploit temporal memory

A

keep the recently accessed data in the cache

21
Q

how do we exploit spacial memory

A

prefetch data before its requested

22
Q

how do we calculate the cache hit rate

A

number of hits/ number of lookups

23
Q

row major order

A

elements in the same row of an array are stored next to eachother in memory

24
Q

stride k reference pattern

A

k = the unit of jumps between memory addresses being accessed

25
Q

how does the cache work

A

read the cache to look for the block
if its already there then you get a cache hit
if not then you get a cache miss
if its a miss then you fetch it from slower memory
if the cache isnt full then add the block to it
if its full then you need to evict an existing block based on the cache eviction policy

26
Q

what are 3 examples of a cache eviction policy

A

belady’s algorithm
least recently used
first in first out

27
Q

belady’s algorithm cache eviction policy

A

evicts the block that wont be used for the longest time

28
Q

what is the issue with belady’s algorithm

A

you will need to know future lookups therefore its not always practical

29
Q

least recently used cache eviction policy

A

evicts the block that hasnt been used in the longest time

30
Q

how can we implement the least recently used cache eviction policy

A

a doubly linked list maintains the block from most to least recently used
a hash table implemented in a dictionary is used for lookups

31
Q

fifo cache eviction policy

A

the cache implements a queue

32
Q

what is the issue with fifo cache eviction policy

A

belady’s anomaly; increasing the cache size leads to a higher number of misses
you may be removing the entry that is most frequently used

33
Q

server side caching

A

stores data temporarily on the server to speed up future access to that data
usually as a db query result

34
Q

what are some benefits of server side caching

A

allows near real time communication by providing low latency
manages popular shared content
massive scalability
allows redundancy and replication ensuring data availability and fault tolerance

35
Q

how do content distribution networks work

A

a client requests a url for a video
the client resolves the domain name from the local dns
the dns returns the domain name to the client who then passes it to the cnd to get the content
the edge serve has cached copies of static content originally hosted on the origin server
when it is first requested it is fetched from the og server and is then cached for resuse

36
Q

what does an edge/ cdn server do

A

replicated the content providers data