Logic and computer systems · GCSE · OCR J277 1.1.2, AQA 8525 3.4.5 · about 15 min
Clock speed, cores and cache, measured with models.
[1 mark]What does a clock speed of 3 GHz mean?
[1 mark]Why might doubling the cores not halve the time a program takes?
[1 mark]Why does more cache usually make a CPU faster?
[1 mark]A job takes 60 seconds on 1 core and all of it can be split. How many seconds on 4 cores?
[1 mark]What is a drawback of a higher clock speed?
Use run_cache(requests, size) on the request list [5, 6, 5, 7, 5, 6, 8, 5, 6, 7], for cache sizes 1 to 6. Print one line for each size in the form size <n>: <hits> hits, then print best size: <n> for the smallest cache that gets the most hits, working it out with a loop.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
def run_cache(requests, size):
cache = []
hits = 0
for address in requests:
if address in cache:
hits = hits + 1
cache.remove(address)
elif len(cache) == size:
cache.pop(0)
cache.append(address)
return hits, len(requests) - hits
requests = [5, 6, 5, 7, 5, 6, 8, 5, 6, 7]Plan your program here, then type it in and press Run.