To really understand TOY program, everybody's encouraged to study the book and try some of the exercises, and read the programs there. We have several TOY programs that you can easily learn from. And today, we'll give a couple more examples of TOY programming, but really, today's lecture is about putting TOY in context. Both in historical context, and to consider some of the implications of having a machine that operates with such simple rules. Let's start by putting TOY a little bit in perspective. So let's consider TOY versus your laptop. They're different, totally different computing machines, while one's imaginary, but they both implement basic data types, conditionals, loops and other low level constructs. You can have arrays, functions, library, and other high level constructs, and we'll talk about that a little bit today, and they both have infinite input and output strings. So really, what you can see, eventually, if you look at this issue enough, is that all the basic building blocks that we studied when you first did Java programming is possible to implement all of them in TOY. Now you might say, well, but TOY has only got 256 words, is that really enough to do anything useful? And it absolutely is. We'll talk about that in just a second. Of course, we definitely want a faster version with more memory when we can afford it, but the point is that everything that we've done with Java really is possible to do with TOY. It's just a matter of scale. So let's talk about this issue, about 256, 16-bit words. That'd be 4096 bits of memory. Is that really enough to do anything useful? So here's an example from an old computer from the 1960s, a 50-year-old computer. In those days, every bit was a physical piece of metal and had three wires running through it. So, 1000 bits was something that was difficult and expensive to produce, but this is an actual 1000 bit memory. If you had four of those, you'd have 4000 bits of memory. Is that enough to do anything useful? Well, actually it is because this thing is the memory from the Apollo Guidance Computer that got men to the moon and back. Here's another example, this is an experimental computer at MIT. Its got more bits, its got 24,000 bits, and this was earlier, this was in the late 1950s. And people were using computers like this, like TOY, to do biomedical experiments and all sorts of other experimentation. This is a gentleman named Wes Clark in the early 1960s, and I put his picture up because his son, Doug Clark, is my colleague, and has taught this course many times. So, let's look at this even in more detail. So, 4000 bits of memory. So actually, if you consider the contents of the memory, registers, and PC at a particular time, we talked about this at the beginning, it provides a complete record of what a program has done and it also completely determines what the machine will do next, towards a deterministic machine based on just these bits of memory. And if we count up the total number of bits involved, well actually, since we used the last location for standard input, there's 255 x 16 bits for memory. Since register zero is always zero, there's 15 x 16 bits for the register, and then there's the PC, so there's a grand total of 4328 bits, but those bits can be either zero or one. So the total number of different states that the machine could be in is 2 to the 4328 power, or that's more than 10 to the 1300th power. That is an enormous number, and the machine can be in any one of those states and that state would determine some new state, completely and uniquely determined. That's such a huge number, I mean, and we talk about this in the theory lecture, as well. If you took every electron in the universe and put a supercomputer examining states for all its entire lifetime, you only get to about 10 to the 109th states. That 10 to the 1300 is a stupefyingly large number. It means you need 10 to the 1200 universes, every electron and all the universes running supercomputers. And these are basic estimates, you can argue with them, but it doesn't effect the main point. And the bottom line is, we'll never know what a machine with 4096 bits of memory can do. There is so, so, so many more states than we'll ever see in the lifetime of the universe. So yes, 4096 bits of main memory is certainly enough to do something useful. Now, let's talk a little bit about some historical context. So a very early computer was called the ENIAC, which was being developed by Mauchly and Eckert. It's often given the distinction of being the first widely-known general-purpose electronic computer. There's a lot of debate about this, and you can read about other candidates as well. It had conditional jumps, it was programmable, but it didn't have memory. Programming was a matter of changing switches and cable connections. So the back of the machine were cables and you re-plug the machine to get it ready to perform certain calculations, and then the machine would crunch data and do things like plot a parabola to figure out where a missile would go or something of the sort. The data came in on punch cards, so there'd be a lot of numbers on punch cards, and the machine would read those numbers and compute with the mets how the ENIAC work. And that was a 30 ton machine that filled a room, it had vacuum tubes, it could do 300 multiplies in a second, and a bit was a physical thing called a vacuum tube. So there were a lot of obstacles to overcome in using a machine like this to solve scientific problems. But definitely, it was running and working and helpful in preparing ballistics tables for use, during the war. Now, there's a famous memo that I want to talk about, called First Draft of a report on the EDVAC, that was written by John von Neumann, a mathematician at Princeton. The EDVAC was the next computer that was proposed to be built by Eckert and Mauchly, and Neumann worked with them over the summer of 1945. But he also was working at Los Alamos on mathematical calculations and simulations for the atom bomb, and he had to take a train to Los Alamos to write up a report on their work on the EDVAC. It turned out that that memo was a brilliant summation of the concept of having a memory and storing a program in the memory, and really complete design of a computer that could do it. Now, von Neumann had heard about the theories of Alan Turing and the idea of a program that could operate on another program as data definitely influenced his thinking on this, and it has influenced the design of every computer since. Reading this memo, particularly after you're done with the next few lectures, where we talk about designing and building such a machine, it's quite striking how much is in this memo that we use regularly today, and every computer does. And so the question of who invented the stored-program computer, there's really a fascinating controversy about that. So, Eckert and Mauchly discussed the idea before von Neumann arrived on the scene and discussed it with von Neumann in their joint work when talking about the design of the EDVAC, but von Neumann wrote everything up. And he was on a long train ride, and he had every part of what he knew at his command, including the amazing theories of Alan Turing. He was in a unique position to put it all together, and that's precisely what he did. Now, when von Neumann arrived in Los Alamos, a young lieutenant, Harold Goldstein, circulated the draft because he could see what an amazing document it was. And there was a lot of interest. But the public disclosure of that draft of the report on the EDVAC meant that Eckert and Mauchly could not patent their design. And of course, they were not very happy about that. von Neumann never specifically took credit for the idea of stored program computing, but he actually never gave credit to others, either. So we're all going to have to make up our minds on this. Another example, just as an indication of the impact of von Neumann's memo, just not very long after the memo was published, Maurice Wilkes in England built another machine called the EDSAC. And that one had lots of characteristics very similar to the machines we use today. The data instructions were loaded in binary. You could load programs, not just data into the memory, and you could change the program without rewiring. And those are all characteristics that we depend on, and we'll come back to this later in this lecture. That machine had 512 17-bit words. Not so different than TOY. Two registers, 16 instructions, the input was paper tape, the output was not paper tape, it was a teleprinter, and there, a bit was a different kind of device, not a vacuum tube. But still, not that much smaller. And this thing came into existence quite quickly because von Neumann's memo so beautifully laid out the blueprint of what needed to be done. So, and in fact, to the architecture, the basic architecture of the stored program computer has been the basis of nearly all computers since the 50s. So, all the things that we use, your phone, server form, PC, and TOY, and the old computers, all had basically the same design that we're going to be looking at in the next couple of lectures. The practical implications of a stored-program computer is that we can download apps. When you download an application into your phone, you're loading a program into the memory of your phone. Seems so straightforward and natural today, but remember, the first computer didn't have that capability. The other thing is we can write programs that make programs as output. That's what compilers and interpreters are and many, many other types of programs that we'll talk about. And you can also write programs to take programs as input, and you can simulate other machines. That was Turing's brilliant concept. So these implications are very profound, as we discussed in a lot more detail in the theory lectures. With TOY, you can solve any problem that any other computer can solve, but you also have the limitation that some problems can't be solved by any computer at all. All of this is by way of justifying, studying TOY carefully. It's a simple machine that has the same characteristics of all of the machines that we use. The only difference is the matter of scale. And that's what we're going to go into next is to look at some of these implications in more detail.