Computers According to Feynman
The File Clerk Model is an idea from Richard Feynman to explain how computers work. According to him, computers are not calculation machines; instead, they are data handlers. They are good at moving data around.
I first heard the idea of the File Clerk Model in this video, and I loved it. This model is the best explanation we can give our grandmas about how computers work.
For example, it helped me understand the Stored Program design, how CPUs move from one instruction to another, and the idea of reusable functions.
Smart File Clerk
Imagine we are a company with many salespeople. We store their data on cards—for example, location, sales, commission rate, name, etc.
We hire a clerk to take care of all the information, and we ask him: “How much commission do we have to pay to the people in California?”
After a while, he comes up with the result because he is a smart clerk.
Dumb File Clerk 1
We hire another clerk who is faster but dumber because he needs to be told exactly what to do, instead of answering a general question. So we need to give him a set of instructions.
- Read a card.
- If the location is California.
- Multiply the sales and commission rate.
- Add the result to a running count.
- Return the card.
- Repeat the process until no cards are left.
- Tell us the result in the running count.
It’s annoying that we can’t just give him the questions. But this lack of intelligence is compensated by being much faster than the smart clerk.
Dumb File Clerk 2
Next, we hire another clerk who is faster and dumber than clerk 1, because he can’t remember numbers. Of course, that means that our instructions need to be more precise.
We give him a piece of paper split into six boxes and a pencil to write down numbers:
The clerk can’t remember the running count of the total commission. So, therefore, we use a new card for that, the “Total” card:
- If the location is California.
- Write the sales in box 1
- Write the commission rate in box 2
- Multiply box 1 and box 2 and write it in box 3
- Take the “Total” card
- Write box 3 in the “Total” card
Dumb File Clerk 3
File clerks are getting dumber and faster. We are still happy because the increase in speed compensates for the extra work. The next one can’t even remember the instructions. Therefore, we need to write the instructions on cards. For example:
Now we have a bunch of cards with the instructions.
Our communication with the clerk goes through cards. When we want some data, we write the instructions on cards and give them to him. This is already similar to a computer.
Dumb File Clerk 4
The last clerk is the dumbest and fastest because he can’t even remember which card to read. Therefore, we add one extra card: “Counter,” where it’s written where to go next.
The clerk reads the “Current location” and adds one by default. Yet, if the instructions send him to a new location in “Next location,” this is the new card that he takes.
Some cards have instructions on them, while others have salesperson data. There is no difference for the clerk; they are all cards.
Dumber and Dumber, but Faster and Faster
Even though the last clerk we used is dumb, he is smarter than a computer. He knows how to multiply and read letters and numbers. Computers can’t do that.
Yet, we can write the steps to calculate the product of two numbers on cards. This means that we could hire a dumber clerk who can’t multiply but is even faster.
These “Multiplication Steps” can be used in many questions, not just in our first question. That means we don’t need to write all the instructions every time we have a new question; we can reuse cards from other questions.
The idea of reusable instructions is synonymous with the idea of functions. And the idea of using the same cards for storing data and instructions is synonymous with the main idea of the Stored-Program design.
Our clerk was dumb, but he moved data around faster than the smart clerk. He didn’t compute anything. He followed the steps and shuffled numbers, but those numbers didn’t mean anything to him.
This is why Feynman said that computers are data handlers. They are very good at managing data, as long as we tell them exactly what needs to be done.
A computer is the dumbest and fastest of the file clerks.
If you like this post, consider sharing it with your friends on twitter or forwarding this email to them 🙈
Don't hesitate to reach out to me if you have any questions or see an error. I highly appreciate it.
And thanks to Michal and Sebastià for reviewing this article 🙏
Thanks for reading, don't be a stranger 👋
GIMTEC is the newsletter I wish I had earlier in my software engineering career.
Every other Wednesday, I share an article on a topic that you won't learn at work.
Join more than 3,000 subscribers below.