Caching and reusable components Flashcards

(30 cards)

1
Q

Define caching.

A

The process of storing previously used data in a location (cache) so that it can be quickly accessed to speed up retrieval if it is needed in the future.

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

Define pre-fetching.

A

Data is fetched and stored in a cache or buffer before it is needed.

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

Define a cache miss.

A

Occurs when a system or application requests data from a cache, but the data is not found

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

Define a library.

A

A collection of reusable subroutines that a programmer can “call” when writing code so that the programmer doesn’t have to write this code.

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

Define reusable components.

A

Use of existing assets in some form within the software product development process including code e.g. subroutine and designs.

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

Why do CPUs have onboard cache?

A

To store frequently used data/instructions.

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

Why is it faster to access the cache than it is to access main memory (RAM)?

A
  • Cache is physically located on the chip
  • Cache uses SRAM which is faster than DRAM which is used for main memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the hierarchy of CPU cache?

A

L1 (smallest + quickest) to L3

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

What happens if the processor needs to read or write a location in memory?

A

It first checks for a corresponding entry in the cache. If the processor finds that the memory location is in the cache, a cache hit has occurred and the processor immediately reads/writes to the cache. If not, a cache miss has occurred and the data is copied from main memory into cache and the request fulfilled from cache.

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

What is a pro of CPU cache?

A

Faster response time.

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

What are cons of CPU cache?

A
  • Small size
  • SRAM is expensive
  • Fixed size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is hard drive cache (HDC) also known as?

A

A disk buffer.

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

What does hard drive cache store?

A

The most recent and frequently used programs/data from the drive.

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

What happens when the CPU requests data from the hard disk?

A

Modern hard disks come with fast memory, around 512 kilobytes. The hard-disk controller checks this memory before moving the mechanical parts of the hard disk (slow compared to memory). If it finds the data that the computer asked for in the cache, it will return the data stored in the cache without actually accessing data on the disk itself, saving a lot of time.

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

What is a pro of hard drive cache?

A

Faster response time.

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

What are cons of hard drive cache?

A
  • Small size
  • Fixed size
17
Q

What does web browser cache store?

A

Frequently used web pages to reduce the number of requests that go to web server.

18
Q

What are pros of web browser cache?

A
  • Faster load time
  • Reduced network traffic
19
Q

What is a con of web browser cache?

A

Cached resource may be but of date.

20
Q

What are proxies?

A

Proxies act as intermediaries between the client and the origin server.

21
Q

What does a cache server store? (proxy server)

A

Previously requested web pages or other content.

22
Q

What are pros of a cache server?

A
  • Faster load time as HTTP request does not have to go to original web server
  • Reduces network traffic
23
Q

What is a con of a cache server?

A

Cached resources might be out of date.

24
Q

What is a DNS? (Domain name system)

A

It is used to resolve a particular domain name to its IP equivalent

25
What happens when a DNS server responds to a DNS request?
The operating system may store results in a local DNS cache
26
What's a pro of DNS cache?
Reduced network traffic (fewer DNS requests)
27
What are cons of DNS cache?
- Cached resource may be out of date - If a web page has crashed the location of its web server in the time since its IP address was cached, a web browser might return an HTML 404 error - although the site is still online. Cache could be maliciously changed to direct users to different sites.
28
What are the general cons of cache?
- Algorithms for caching can be very complicated. When the cache is full, the algorithm must choose which items to discard to make room for the new ones. - Wrong data may be cached then it has to be removed and the correct data loaded. - Cache does not have the required content (cache miss) so time is wasted checking it.
29
What are pros of reusable design components?
- Saves time and resources - Can sell code to a third party. The buyer knows how it works and how much it costs and can get it straight away. - Increased dependability, i.e the code has been tried and tested in working systems - A particular element can be written by a specialist. Good if the development team don't have experience for something specific. - Update one library and every program that uses it is updated - don't have to manually change code
30
What are the cons of reusable design components?
- The reusable component must be available in the required language - Some programmers will prefer to write their own code - The reusable components have to be stored somewhere accessible - You have to find, understand and possibly adapt the reusable component