Seibel: Did that hone your debugging skills or was it all just incrediblystupid stuff?
Thompson: It honed that type of debugging—you understood commonerrors really well after that. Somebody who had spent days working ontheir program would come in and you’d say, “Right there!”
Seibel: And your degree was in double E? Did they offer a computer sciencedegree at that point?
Thompson: No, all over the United States at the time computer sciencewas trying to come out, and it was coming out in two ways. It was comingout theoretically through math, or practically through double E. In Berkeley,computer science at that point was almost exclusively inside of electricalengineering. Math was trying, but they just weren’t politically astute enoughto compete with these old grizzled guys.
Seibel: Berkeley obviously ended up being known for things like theBerkeley Systems Lab—building things—as opposed to being renowned forcontributions to theory.
Thompson: Yes, absolutely. This is the genesis of either a theoreticalcomputer-science department, like Cornell, or the Berkeley kind ofcomputer science. It really gives the flavor to the place. So I spent one yearin graduate school there, not because I had any ambitions for anything. It’sjust 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 Ididn’t even apply for graduate school. One of the professors essentiallyapplied 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 justimmense fun. I didn’t do anything that I didn’t want to do. There were norequirements, no nothing. To graduate I took a summer course in Americanhistory or something, some requirement, to get a degree. But outside ofthat, my senior year and my graduate year I taught about half of the coursesI took.
The basic theory of computing was just coming out then. Shell sort cameout and no one could figure out why it was faster than n-squared sort. Andso everyone was doing tests on it and trying to figure out—it’s pretty easyto see it sorts, but nobody knows why it’s fast. And they were taking theasymptote 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 theintellectual attraction to shell sort and why it was fast—came all this speedorder of computing. And the first n log ns and divide and conquer and allthat struck. It was an amazing, exciting era.
I had friends, a bunch of these very junior professors—a math professor Iwas real close to, and a double-E professor I was close to, and the graduatestudent that I worked for, and others. They would invent a class for me, andthen I would teach the class.
Seibel: Were you officially taking the class or were you actually on thebooks as teaching it?
Thompson: No, no, I wasn’t on the books as teaching it. They were alldouble-E 199, which meant individual research or group research orsomething. And they would invent a class and give it a title and then turn itover 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 yearoff 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 toBerkeley to teach and to learn the classes I was teaching from the bottomup since I never had a computer-science education. A normal visitingteacher teaches one class. I taught five classes. Some classes I taught twiceand I thought they were the best because the first year I was learning andthe second time I taught it I knew where it was going and I could present itorganized and be two steps ahead of the students. The third class was justboring. I taught one class three times and it was just wrong. So I could neverbe a teacher because you end up teaching your class over and over andover. I could never do that. But I love the teaching: the hard work of a firstclass, 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 thepentaminos 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 thephysics department. I knew where all the underground computers were inthe place, and I had them all running at night doing my jobs. Plus, at the maincomputer center I probably had 20 accounts under different rocks. Thereare 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 alltogether on the board there are two configurations that are—I don’tknow—appealing. One is the most square, which is ten-by-six, and then thesecond is eight-by-eight with a two-by-two hole in the middle. And I solvedall configurations of those two boards of how you place the pieces for thoseboards. And I did it generically by laying out a pattern of the boards andthen laying out pattern pieces, and then it would fit the pieces in thepatterns. 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’tremember.
Seibel: You must have learned Fortran somewhere along the line.
Thompson: Yeah, well, I had to teach Fortran in the computer center anddebug the Fortran programs. I never programmed in it. I wrote a Fortrancompiler for Unix early, and B was an attempted Fortran compiler that gotaway 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 beFortran. And at that point I got my first description of BCPL. And I liked theclean semantics. And that’s when I abandoned Fortran and it turned intoessentially C syntax and BCPL semantics.
Seibel: Is there any really big differences in how you think aboutprogramming or how you practice programming from when you learned tonow? Do you feel like your programming has matured in some way or yougot 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 weekreading that program to maybe when I was 30, 35 years old, I knew, in adeep sense, every line of code I ever wrote. I’d write a program during theday, 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 stuffyou 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 toprogram? Do you have any regrets about the sort of path you took or doyou wish you had done anything earlier?
Thompson: Oh, sure, sure. In high school I wish I’d taken typing. I sufferfrom poor typing yet today, but who knew. I didn’t plan anything or doanything. I have no discipline. I did what I wanted to do next, period, all thetime. If I had some foresight or planning or something, there are things, liketyping, I would have done when I had the chance. I would have taken somedeeper math because certainly I’ve run across things where I have to gethelp for math. So yeah, there are little things like that. But if I went back andhad to do it over I’m sure that I just wouldn’t have it in me to do anythingdifferently. Basically I planned nothing and I just took the next step. And if Ihad to do it over again, I’d just have taken the next step again.