Component 2 Flashcards
What is a cache hit?
A cache hit is when the data/instructions are found in cache
What is a compulsory miss?
The first time data is fetched there is no way it is in cache so it has to be missed
What is a capacity miss?
When the data/instruction in cache has been evicted as it is full
Describe the prefetching algorithm
Instructions are prefetched from RAM to cache before it is actually needed which will reduce time if the user then wants that bit of data or the instruction. This is used to combat compulsory misses
What is one advantage and one disadvantage of the prefetching algorithm?
One advantage is that it may lower CPU processing time if it prefetches the right thing, however if it doesn’t call the right thing it then has to wait to remove that and then bring the needed data in which would slow the overall process down
List 2 eviction algorithms and how they are used
1) Clairvoyant algorithm uses statistical analysis of the users past to predict what they may need so it can be swapped in
2) LRU (Least recently used) which removes the least used items in cache, however may be hard to implement
3) Random replacement, which simply removes an item from cache at random
Give two advantages of caching
1)Allows faster response times as data doesn’t need to be read from the disk
2)It reduces the load on the system or web server if it is web caching
What is the purpose of using documentation, give an advantage and a disadvantage
Documentation is used to allow other developers to follow the code more easily and understand the preconditions for a certain function. A disadvantage of this is that it could take a long time to write
What is passing by reference?
Passing by reference is where a specific memory address is passed into a function which is not a copy, so the original value of the variable is changed within the function
What is passing by value?
Passing by value is where a copy of the value is made in memory of the original variable so the copy is sent meaning the original value isn’t changed
List 3 types of abstraction and what they are
1)Representational = Representing real world items like a station with a more simple object like a circle
2) Generalisation = Generalising an object into it’s fundamental properties
3) Information hiding = Hiding info from the user that they don’t need to see
4) Functional abstraction = Not knowing how all of the functions work, eg) .sort() or .randint()
5)Procedural abstraction = Using reusable procedures (Modularisation)
6)Data abstraction = Using complex data structures like stacks instead of many variables
7) Problem abstraction = Generalising and removing unwanted details
Give 2 advantages of abstraction
It allows a more efficient design process, reduces time needed to code and debug and saves system resources
Give a disadvantage of abstraction
Too much abstraction can simplify the problem too far and so it may be too simple
What is abstraction?
Abstraction is the process of removing unneeded details from the problem making it easier to solve
What is decomposition?
Decomposition is the process of breaking down a problem into larger subproblems allowing them to be solved easier