yeolyi.comSeongyeol's CS

Stored Programs

So far we’ve designed a new circuit for every job, like the traffic light and the door lock. To give the machine a new job, we have to design yet another circuit for it.

But the computers we use are different. We don’t swap chips when we install a new game on our phone. How is that possible?

The wiring is the job

Let’s build a door lock the way we’ve been doing. The door opens only when four switches are set to the password. If the password is 1011, positions that should be 1 stay as they are, positions that should be 0 are flipped with a NOT, and the four are ANDed together. The door opens only when all four are 1.

Set the switches to 1011 from the top to open the door.

What if we change the password to 0110? We have to rewire the circuit, starting with where the NOTs go. Below is the door lock rewired for 0110.

Setting the switches to 0110 opens it, and 1011 no longer does.

Changing a single password means rewiring. What the machine does is built into its wiring.

Programs made of wires

ENIAC, the first general-purpose electronic computer, completed at the end of 1945, also had to be rewired to change its job. Franz Alt, who worked with ENIAC, later recalled that getting one problem ready to run meant connecting thousands of wires, which took days, and checking the setup took even more days (Communications of the ACM, 1972).

ENIAC’s program was an arrangement of plugged-in wires.

Programmers plugging wires into ENIAC's panels (photo: U.S. Army · public domain)
Programmers plugging wires into ENIAC's panels (photo: U.S. Army · public domain)

Jobs in memory

In 1945, John von Neumann, together with the ENIAC team, wrote up the design of the next computer in a report. The key idea was to write the job as numbers and store it in memory instead of in wiring. The machine reads the job from memory one step at a time and does it. Just as a player piano plays by reading a punched paper roll, swapping the roll gives a different song. This list of steps is a program, and this approach is called the stored-program computer.

Programs as numbers

Once the job becomes numbers, three things change.

Wrapping up

Writing the job as numbers in memory turns one machine into a computer that can do anything. We already have almost every part this machine needs. There is memory to hold the job, and a counter can keep track of which step to read next. In the next post, let’s connect the two and build this machine ourselves.

Challenge

One machine sets its job with wiring, like ENIAC, and another writes its job as numbers stored in memory. Which of the following can the wired machine never do, no matter how long it takes?