# The problem with memory

It’s time, at last, to start looking at the design for the computer’s memory and this is a bit of a game changer as it’s the final part of the jigsaw that lets the computer run a program. However, it’s also the part of the computer that leaves me in a bit of a quandary.

The problem with memory is that typically you need quite a lot of it and that’s something that doesn’t come easy with relays. In a way the registers already present in the computer are a kind of memory … they store a single byte of data. So, effectively you can get two bytes worth of storage on one of the usual computer cards. You can maybe see where this is going.

Each instruction in a program takes a byte of memory therefore a 10 line program needs 10 bytes of memory. How long does a program need to be? Well is depends but for this kind of computer 20 to 30 wouldn’t be unreasonable it you’re going to do something ‘interesting’. It’s not just the instructions that need storing though. Eventually the computer will also have instructions to load and store values in memory so that you can have more values ‘on the go’ than could be held in the registers alone. Storing the program as well as data in the same physical memory is known as a Von Neumann architecture (named after the mathematician and physicist who wrote a paper on it). Alternatively a computer could use a Harvard architecture where the program is stored separately.

So can you see the problem? Let’s say we have a program that’s 30 lines long plus we want to store an additional ten data values (as bytes) to work upon then we’re looking at a total of 40 bytes of memory. That doesn’t sound much if you think of modern computers with 8 or 16Gb but in this case I’d have to make 20 register type cards to store those 40 bytes. Apart from that boring me to tears constructing that many registers it’d also take up a lot of room and making a compact relay computer was one of my primary goals. Also, if you want to add an extra line to the program then it’s time to get the soldering iron out again.

What’s the alternative then? Well, there’s not much choice if I’m to stick with relays. I wanted to try and keep the computer ‘authentic’ and with a traceable route right back to the Konrad Zuse Z3. Now you could say that by using LEDs it looses authenticity but it’s just a newer version of a lightbulb in the same way the miniature relays I use are a modern equivalent of the Z3 relays - the ‘feeling’ is the same and the experience of the computer running is very similar. The Z3 was the original inspiration for making this computer which, via a bit of surfing on the net, found me at the Harry Porter relay computer and that’s where the seed was truly sown. Actually, I re-discovered the video of the Z3 that started it all so I thought I’d share it below (it’s in German but you’ll get the general idea):

So, if I’m going to get more memory in less space I need to wind the clock forward a bit and choose a newer technology. I was seriously tempted by magnetic core memory … I saw one of these at the National Museum of Computing in Bletchley Park, UK (yes, the ‘Alan Turing’ Bletchley Park) I was immediately smitten. Core memory is just so intricate … however, it’s therefore an absolute pain to build and although it’s much smaller than the relay equivalent you still don’t get a decent density of memory for the space taken.

What did I do then? … I gave up and rolled the clock all the way forward and decided to use a modern(ish) memory chip instead. If you need any justification I think this picture says it all. Now, I’m not suggesting I’m going to add 8Gb of memory to my computer (which would be quite extreme) but bigger is usually better when it comes to memory. However, the memory itself is not the only consideration that needs to be made. You need a way of telling the memory which location to store or retrieve the value from and that’s where the address bus comes in.