Seibel: Did that hone your debugging skills or was it all just incredibly stupid stuff?
Thompson: It honed that type of debugging—you understood common errors really well after that. Somebody who had spent days working on their program would come in and you’d say, “Right there!”
Seibel: And your degree was in double E? Did they offer a computer science degree at that point?
Thompson: No, all over the United States at the time computer science was trying to come out, and it was coming out in two ways. It was coming out theoretically through math, or practically through double E. In Berkeley, computer science at that point was almost exclusively inside of electrical engineering. Math was trying, but they just weren’t politically astute enough to compete with these old grizzled guys.
Seibel: Berkeley obviously ended up being known for things like the Berkeley Systems Lab—building things—as opposed to being renowned for contributions to theory.
Thompson: Yes, absolutely. This is the genesis of either a theoretical computer-science department, like Cornell, or the Berkeley kind of computer science. It really gives the flavor to the place. So I spent one year in graduate school there, not because I had any ambitions for anything. It’s just because I had nothing else to do and I was having a good time.
Seibel: Immediately after college?
Thompson: Yeah. To be honest, I was working at the university and I didn’t even apply for graduate school. One of the professors essentially applied for me and told me I was in graduate school.
Seibel: Still in double E?
Thompson: Right. My senior year and my graduate year were just immense fun. I didn’t do anything that I didn’t want to do. There were no requirements, no nothing. To graduate I took a summer course in American history or something, some requirement, to get a degree. But outside of that, my senior year and my graduate year I taught about half of the courses I took.
The basic theory of computing was just coming out then. Shell sort came out and no one could figure out why it was faster than n-squared sort. And so everyone was doing tests on it and trying to figure out—it’s pretty easy to see it sorts, but nobody knows why it’s fast. And they were taking the asymptote and figuring out why it was n to the 1.3 or something like that. And that’s just not a natural number. And from that—shell sort and the intellectual attraction to shell sort and why it was fast—came all this speed order of computing. And the first n log ns and divide and conquer and all that struck. It was an amazing, exciting era.
I had friends, a bunch of these very junior professors—a math professor I was real close to, and a double-E professor I was close to, and the graduate student that I worked for, and others. They would invent a class for me, and then I would teach the class.
Seibel: Were you officially taking the class or were you actually on the books as teaching it?
Thompson: No, no, I wasn’t on the books as teaching it. They were all double-E 199, which meant individual research or group research or something. And they would invent a class and give it a title and then turn it over to me. And there’d be three or four students there.
Seibel: Of which, officially, you were one.
Thompson: Yes.
Seibel: Did you like teaching?
Thompson: To an extent. I’ve gone back and taught twice. Taken a year off and taught one year at Berkeley in ’75–‘76 and one year in Sydney in ’88. It’s fun. I really, really enjoy it. I was doing research in the labs and I went to Berkeley to teach and to learn the classes I was teaching from the bottom up since I never had a computer-science education. A normal visiting teacher teaches one class. I taught five classes. Some classes I taught twice and I thought they were the best because the first year I was learning and the second time I taught it I knew where it was going and I could present it organized and be two steps ahead of the students. The third class was just boring. I taught one class three times and it was just wrong. So I could never be a teacher because you end up teaching your class over and over and over. I could never do that. But I love the teaching: the hard work of a first class, the fun of the second class. Then the misery of the third.
Seibel: What was the first interesting program you wrote?
Thompson: The first long computational program I wrote was solving the pentaminos problem. Do you know it?
Seibel: The tile game, right?
Thompson: It’s a tile game. And I ran it on an IBM 1620 that was in the physics department. I knew where all the underground computers were in the place, and I had them all running at night doing my jobs. Plus, at the main computer center I probably had 20 accounts under different rocks. There are 12 pentaminos. These are different tile pieces made out of 5 squares. And there are 12 different such shapes.
Seibel: Sort of like Tetris tiles.
Thompson: Yes. But every piece has five squares. If you put them all together on the board there are two configurations that are—I don’t know—appealing. One is the most square, which is ten-by-six, and then the second is eight-by-eight with a two-by-two hole in the middle. And I solved all configurations of those two boards of how you place the pieces for those boards. And I did it generically by laying out a pattern of the boards and then laying out pattern pieces, and then it would fit the pieces in the patterns. It didn’t know it was pentaminos.
Seibel: This was basically brute-force search?
Thompson: Brute force.
Seibel: And so this was also in assembly probably?
Thompson: I have to think. Yeah, it was probably assembly. I can’t remember.
Seibel: You must have learned Fortran somewhere along the line.
Thompson: Yeah, well, I had to teach Fortran in the computer center and debug the Fortran programs. I never programmed in it. I wrote a Fortran compiler for Unix early, and B was an attempted Fortran compiler that got away from me.
Seibel: I thought B was your translation of BCPL.
Thompson: It sort of was. It started off as—I didn’t know what it was. Semantically, it turned out to be BCPL. As I started it, it was going to be Fortran. And at that point I got my first description of BCPL. And I liked the clean semantics. And that’s when I abandoned Fortran and it turned into essentially C syntax and BCPL semantics.
Seibel: Is there any really big differences in how you think about programming or how you practice programming from when you learned to now? Do you feel like your programming has matured in some way or you got better at it or you learned things that make you look back and say, “Oh, man, I didn’t know what I was doing back then.”?
Thompson: No, not really. Sometimes I look back at stuff I did and say, “Wow. I was much better then.” The period from when I spent that week reading that program to maybe when I was 30, 35 years old, I knew, in a deep sense, every line of code I ever wrote. I’d write a program during the day, and at night I’d sit there and walk through it line by line and find bugs. I’d go back the next day and, sure enough, it would be wrong.
Seibel: Do you think when you were 35 you could still remember the stuff you had written a decade before?
Thompson: Yes. Then I started being selective about what I’d remember.
Seibel: Is there anything you would have done differently about learning to program? Do you have any regrets about the sort of path you took or do you wish you had done anything earlier?
Thompson: Oh, sure, sure. In high school I wish I’d taken typing. I suffer from poor typing yet today, but who knew. I didn’t plan anything or do anything. I have no discipline. I did what I wanted to do next, period, all the time. If I had some foresight or planning or something, there are things, like typing, I would have done when I had the chance. I would have taken some deeper math because certainly I’ve run across things where I have to get help for math. So yeah, there are little things like that. But if I went back and had to do it over I’m sure that I just wouldn’t have it in me to do anything differently. Basically I planned nothing and I just took the next step. And if I had to do it over again, I’d just have taken the next step again.