Lex Fridman Podcast - #109 – Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming
Episode Date: July 19, 2020Brian Kernighan is a professor of computer science at Princeton University. He co-authored the C Programming Language with Dennis Ritchie (creator of C) and has written a lot of books on programming, ...computers, and life including the Practice of Programming, the Go Programming Language, his latest UNIX: A History and a Memoir. He co-created AWK, the text processing language used by Linux folks like myself. He co-designed AMPL, an algebraic modeling language for large-scale optimization. Support this podcast by supporting our sponsors: - Eight Sleep: https://eightsleep.com/lex - Raycon: http://buyraycon.com/lex If you would like to get more information about this podcast go to https://lexfridman.com/ai or connect with @lexfridman on Twitter, LinkedIn, Facebook, Medium, or YouTube where you can watch the video versions of these conversations. If you enjoy the podcast, please rate it 5 stars on Apple Podcasts, follow on Spotify, or support it on Patreon. Here's the outline of the episode. On some podcast players you should be able to click the timestamp to jump to that time. OUTLINE: 00:00 - Introduction 04:24 - UNIX early days 22:09 - Unix philosophy 31:54 - Is programming art or science? 35:18 - AWK 42:03 - Programming setup 46:39 - History of programming languages 52:48 - C programming language 58:44 - Go language 1:01:57 - Learning new programming languages 1:04:57 - Javascript 1:08:16 - Variety of programming languages 1:10:30 - AMPL 1:18:01 - Graph theory 1:22:20 - AI in 1964 1:27:50 - Future of AI 1:29:47 - Moore's law 1:32:54 - Computers in our world 1:40:37 - Life
Transcript
Discussion (0)
The following is a conversation with Brian Kernigan, a professor of computer science at Princeton University.
He was a key figure in the computer science community in the early Unix days alongside Unix creators,
Ken Thompson and Dennis Richey.
He co-authored the C programming language with Dennis Richey, the creator of C,
and has written a lot of books on programming, computers, and life, including the
practice of programming, the goal programming language, and his latest Unix, a history, and a memoir.
He co-created AAC, the text processing language used by Linux folks like myself.
He co-designed Ample, an algebraic modeling language that I personally love and have used a lot in my life
for large scale optimization. I think I can keep going for a long time with this creations
and accomplishments, which is funny because given all that, he's one of the most humble
and kind people I've spoken to on this podcast. Quick summary of the ads, two new sponsors, the amazing self-cooling,
eight-sleep mattress, and Raycon earbuds. Please consider supporting the podcast by going to
8sleep.com slash Lex and going to buy Raycon.com slash Lex. Click the links by the stuff.
to buyraycon.com slash Lex. Click the links by the stuff. It really is the best way to support this podcast and the journey I'm on. If you enjoy this thing subscribe by YouTube, review
with 5,000 Apple podcasts, support it on Patreon or connect with me on Twitter at Lex
Friedman. As usual, I'll do a few minutes of ads now and never any ads in the middle
that can break the flow of the conversation
This show is sponsored by
8th sleep and it's incredible pod pro mattress that you can check out at 8sleep.com slash Lex to get $200 off
The mattress controls temperature with an app and can cool down to as low as 55 degrees
Research shows the temperature has a big impact on the quality of our sleep.
anecdotally it's been a game changer for me.
I love it.
The pop pro is packed with sensors that track heart rate, heart rate variability and respiratory
rate, showing it all on their app once you wake up.
Plus if you have a partner, you can control the temperature of each side of the bed
I don't happen to have one, but the A-Sleep app reminds me that I should probably get on that
So ladies if a temperature controlled mattress isn't a good reason to apply. I don't know what is
The app's health metrics are amazing, but the cooling alone is honestly worth the money. As some of you know, I don't
always sleep, but when I do, I choose the A-Sleep Pod Pro mattress. Check it out at A-Sleep.com-slash-lex
to get $200 off. This show is also sponsored by Raycon Earbuds. Get them at buy-raycon.com-slash-lex.
on earbuds. Get them at buyraycon.com slash Lex. They've quickly become my main method of listening to podcasts, audio books, and music. When I run, do the pushups and pull-ups
that I've begun to hate at this point or just living life. In fact, I often listen to
brown noise with these when I'm thinking deeply about something. It helps me focus the mind. They're super comfortable, pair easily, great sound, great bass, six hours of playtime. In
fact, for fun, I have one of the earbuds in now and I'm listening to Europa by
Santana, probably one of my favorite guitar songs. It kind of makes me feel like
I'm in a music video. So they told me to say that a bunch of celebrities use these like
Snoop Dogg, Melissa Etheridge, and Cardi B. I don't even know who Cardi B is, but her
earbud game is on point. To mention celebrities I actually care about, I'm sure if Richard
Feynman was still with us, he'd be listening to the Joe Rogan experience with Raycon earbuds.
Get them at buyraycon.com slashlex.
It's how they know I sent you and increases the chance that he'll support this podcast
in the future.
So for all of the sponsors, click all of the links.
It really helps this podcast.
And now here's my conversation with Brian Kernigan. Music
Unix started being developed 50 years ago and be more than 50 years ago.
Can you tell the story like you described in a new book of how Unix was created?
Ah, if I can remember that far back, it was some while ago.
So I think the gist of it is that at Bell Labs, in 1969 there were people who had just finished working on the
multi-ex project which was itself a follow-on to CTSS. So we can go back sort of an
infinite regress in time but the CTSS was a very very very nice time sharing
system was very nice to use. I actually used it as that summer ice bent in
Cambridge in 1966. Well What was the hardware there?
Right. So what's the operating system?
What's the hardware there?
What's the CTS look like?
So CTSS looked like kind of like a standard time sharing system.
Certainly.
If the time it was the only time sharing, if no, let's go back to the basic.
What's the time sharing system?
Okay.
In the beginning was the word and the word.
And then there was time sharing systems.
Yeah.
If we go back into let's call it the 1950s and early 1960s, most computing was done on
very big computers, physically big, although not terribly powerful by today's standards,
that were maintained in very large rooms. And you use things like punch cards to write
programs on, talk to them. So you would take a deck of cards,
write your program on it, send it over a counter, hand it to an operator, and some while later,
back would come something that said, oh, you made a mistake, and then you'd recycle. And so it's
very, very slow. So the idea of time sharing was that you take basically that same computer,
but connect to it with something that looked like an electric typewriter.
They could be a long distance away.
It could be closed.
But fundamentally, what the operating system did was to give each person who was connected
to it and wanting to do something a small slice of time to do a particular job.
So I might be editing a file, so I would be typing. And every time I hit a
keystroke, the operating system would wake up and said, oh, he typed a character. Let me remember that.
Then I'd go back to doing something else. So I'd be going around and around a group of people who
were trying to get something done, giving each a small slice of time and giving them each the
illusion that they pretty much had the whole machine to themselves, enhance time sharing, that is sharing the computing time resource of the computer among a number of people who were doing it.
Without the individual people being aware that there's others in a sense,
the illusion, the feelings that the machine is your own.
Pretty much that was the idea. Yes, you had, if it were well done,
and if it were fast enough and other people
weren't doing too much, you did have the illusion that you had the whole machine to yourself and
it was very much better than the bunch card model. And so CTSS, the compatible time sharing system,
was I think arguably the first of these. It was done, I guess technically 64 or something like that, it ran on IBM 7094, slightly modified
to have twice as much memory as the norm. It had two banks of 32k words instead of one. So
32k words. Each word was 36 bits. So call it, you know, about 150 kilobytes times two. So by
today's standards, that's down in the
noise, the time that was a lot of memory and memory was expensive. So CTSS was
just a wonderful environment to work on. It was done by the people that MIT
led by Fernando Corbatov, Corby who died just earlier this year and a bunch of
other folks. So I spent the summer of 66 working on that,
had a great time, met a lot of really nice people
and indirectly, new of people at Bell Labs,
who were also working on a follow-on to CTSS
that was called Maltix.
The Maltix was meant to be the system
that would do everything that CTSS did,
but do it better forTSS did, but do
it better for a larger population, all the usual stuff.
Now, the actual time sharing the scheduling, how much, what's the algorithm that performs
the scheduling?
What's that look like?
How much magic is there?
What are the metrics?
How does it all work in the beginning?
So, the answers I don't have a clue.
I think the basic idea was nothing more than who all
wants to get something done.
Suppose that things are very quiet in the middle of the night, then I get all the time that
I want.
Suppose that you and I are contending at high noon for something like that, then probably
the simplest algorithm is a round robin one that gives you a bit of time, gives me a
bit of time.
And then we could adapt to that, like, what are you trying to do? Are you text editing, or are you compiling, or something, and we might
adjust the schedule according to things like that. So, okay, so Maltix was trying to just do some
of the cleaning up a little bit. Well, it was meant to be much more than that. So, Maltix
was the multiplexed information and computing service, and it was meant to be a very large
thing that would provide computing utility, something that where you could actually think was the multiplexed information and computing service. And it was meant to be a very large thing
that would provide computing utility,
something that where you could actually think of it
as just a plug-in-the-wall service.
Sort of like cloud computing today, same idea.
But 50 ideas earlier.
And so what Maltix offered was a richer operating system
environment, a piece of hardware that was better designed for doing the kind of sharing of resources, and presumably lots of other
things.
Do you think people at that time had the dream of what cloud computing has started to
become now, which is computing is everywhere that you can just plug in almost, you know,
you never know how the magic works.
You just kind of plug in at your little computation, you need to perform and it does it.
Was that the dream?
I don't know where that was the dream.
I wasn't part of it at that point.
I remember I was in the intern for a summer, but my sense is given that it was over 50
years ago, yeah, they had that idea that it was an information utility that it was something
where if you had a computing task to do, you could just go and do it.
Now, I'm betting that they didn't have the same view of computing for the masses.
Let's call it the idea that, you know, your grandmother would be shopping on Amazon.
I don't think that was part of it.
But if your grandmother were a programmer, it might be very easy for her to go and use this kind of utility.
What was your dream of computers at that time? What did you see as the future of computers?
Because you have predicted what computers are today.
I have no clue. I'm not sure I had a dream. It was a dream job in the sense that I really enjoyed what I was doing. I was surrounded by really, really nice people. Cambridge is a very fine city to live in in the summer,
less so in the winter when it's nose, but in the summer it was a delightful time. And so I really
enjoyed all of that stuff and I learned things. And I think the good fortune of being there for
summer led me then to get a summer job at Bell Labs the following summer.
And that was quite a useful for the future.
So this Bell Labs is this magical legendary place. So first of all, where is Bell Labs?
And can you start talking about that journey towards Unix at Bell Labs?
Yeah, so Bell Labs is physically scattered around,
at the time, scattered around New Jersey.
The primary location was in a town called Murray Hill,
or a location called Murray Hill,
it was actually across the boundary
between two small towns in New Jersey
called New Providence and Berkeley Heights.
Think of it as about 15, 20 miles
straight west of New York City,
and therefore, but in
our north of here in Princeton.
At that time, it had, make up a number of 3, 4,000 people there, many of whom had PhDs
and mostly doing physical sciences, chemistry, physics, materials, kinds of things, but very
strong math and rapidly growing interest, I mean, computing
as people realized you could do things with computers that you might not have been able
to do before.
You could replace labs with computers that had worked on models of what was going on.
So that was the essence of Bell Labs.
And again, I wasn't a permanent player there.
I was, that was another internship.
I got lucky in internships. I mean, if you could just linger in a little bit. What was the
what was in the air there? Because some of the just the number of Nobel prizes, the number
of touring awards and just legendary computer scientists that come from their inventions,
including developments, including Unix, it's just unbelievable. So was there something special about
that place? Well, I think there was very definitely something special. I mentioned the number of
people, so very large number of people, very highly skilled, and working in an environment where there
was always something interesting to work on because the goal of Bell Labs, which was a small part of AT&T,
which provided basically the country's phone service.
The goal of AT&T was to provide service for everybody, and the goal of Bell Labs was to try and make that service keep getting better, so improving service.
And that meant doing research on a lot of different things, physical devices, like the transistor or fiber optical cables or microwave
systems, all of these things the labs worked on.
And it was kind of just the beginning of real boom times and computing as well.
Because when I was there, I went there first in 66.
So computing was at that point fairly young.
And so people were discovering that you could do lots of things with computers. So how's Unix born? So, Maltix, in spite of having an enormous number, really good ideas,
lots of good people working on it fundamentally, didn't live up at least in the short run,
and I think ultimately really ever, to its goal of being this information utility. It was too expensive and certainly what was promised
was delivered much too late. And so in roughly the beginning of 1969, Bell Labs pulled out of the
project. The project at that point had included MIT, Bell Labs, and general electric, general
electric made computers, general electric was the hardware operation.
So Bell Labs realizing this wasn't going anywhere
on a time scale, they cared about,
pulled out a project.
And this left several people with an acquired taste
for really, really nice computing environments,
but no computing environment.
And so they started thinking about,
what could you do if you're gonna design a new operating system that would provide the same kind of comfortable computing as CTSS head, but also the facilities of something like
Maltix sort of brought forward.
And so they did a lot of paper design stuff.
And at the same time, Ken Thompson found what is characterized as a little used PDP 7 where he started to do experiments
with file systems, just how to store information on a computer in a deficient way. And then this
famous story that his wife went away to California for three weeks, taking their one-year-old son
and three weeks, and he sat down and wrote an operating system, which all took him and they
became Unix. So software productivity was good in those days.
So PDP, what's a PDP 7?
So it's a piece of hardware.
Yeah, it's a piece of hardware. It was one of early machines made by digitally equipment corporation,
deck. And it was a mini computer, so called it had, I would have to look up the numbers exactly, but it had a very small
amount of memory, maybe 16-k, 16-bit words or something like that, relatively slow. Probably
not super expensive, maybe, again, making this up, I'd have to look at up a hundred thousand
dollars or something like that, which is not super expensive enough. It was expensive,
it was enough that you and I probably wouldn't be right by one But a modest group of people could get together
But in any case in it came out if I recall in 1964 so by 1969 it was getting a little obsolete
And that's why it was little used
If you can sort of comment what do you think it's like to write an operating system like that?
So that process that can went through in three weeks,
because you were, I mean, you're part of that process.
You contributed a lot to E-Nix's early development.
So what do you think it takes to do that first step,
that first kind of from design to reality on the P2P?
Well, let me correct one thing.
I had nothing to do with it.
So I did not write it.
I have never written operating system code.
And so I don't know.
Now an operating system is simply code.
And this first one wasn't very big,
but it's something that lets you run processes
of some, let you execute some kind of code
that has been written.
It lets you store information for periods of time
So that it doesn't go away when you turn the power off or reboot or something like that
And there's a kind of a core set of tools that are technically not part of an operating system
But you probably need them in this case can wrote an assembler for the pdp7 that it worked
He did a text editor so that
he could actually create text. He had the file system stuff that he had been working
on, and then the rest of it was just a way to load things executable code from the file
system into the memory, give it control, and then recover control when it was finished
or in some other way quit. What was the code written in the primarily
the programming language was in assembly?
Yeah, PDP-7, a similar that can create it.
These things were assembly language
until probably the, call it 1973 or 74,
something like that.
I mean, forgive me if it's a dumb question,
but it feels like a daunting task
to write any kind of complex system in assembly.
Absolutely.
It feels like impossible to do any kind of what we think of as software engineering
of assembly because to work in a big picture.
I think it's hard. It's been a long time since I wrote assembly language. It is absolutely
true. In assembly language, if you make a mistake, nobody tells you. There there are no training wheels whatsoever. And so stuff doesn't work. Now what? And there's not the
bookers. Well, there could be debuggers, but that's the same problem. Right. How do you actually
get something that will help you debug it? So part of it is is an ability to see the big picture.
Now, these systems were not big in the sense that today's picture is large. So the big picture. Now these systems were not big in the sense that today's picture
is actually the big picture was in some sense more manageable. I mean, then realistically
there's an enormous variation in the capabilities of programmers. And Ken Thompson, who did
that first one, is kind of the singularity in my experience of programmers with no disrespect to you or even to me. He's in a
eye. Several leagues removed. I know there's levels. It's a fascinating thing
that there are unique stars in particular in the programming space and in a
particular time. You know, the time matters to the timing of when that person
comes along. And the wife does have to leave. Like there's this weird timing that happens
that in an all sudden something beautiful is created.
I mean, how does it make you feel that there's a system
that was created in three weeks
or maybe you can even say in a whim,
but not really, but of course, quickly,
that is now, you could think of most of the computers
in the world running on a Unix
like system.
Right.
What?
What?
How do you interpret that?
Like, if you kind of zoom from the alien perspective, if you're just observing Earth,
at all send these computers to cover the world, and they started from this little initial
seed of Unix, how does that make you feel?
It's quite surprising, and you asked earlier about prediction.
The answer is no. There's no way you could predict that kind of evolution.
And I don't know whether it was inevitable or just a whole sequence of blind
lock. I suspect more of the latter. And so I look at it and think, gee,
that's kind of neat.
I think the real question is what does
Ken think about that? Because he's the guy arguably from whom it really came. You know,
tremendous contributions from Dennis Richie and then others around in that Bell Labs environment.
But, you know, if you had to pick a single person, that would be Ken.
See, if written in your book, Unix, the History and the Memoir, are there some memorable
human stories funny or profound from that time that just kind of stand out?
Oh, there's a lot of them in a sense.
And again, it's a question of, can you resurrect them in real time?
Just memory fails.
But I think part of it was that Bill Labs at the time was a very special kind of place
to work because there were a lot of interesting people and the environment was very, very open and free.
It was a very cooperative environment, very friendly environment.
And so if you had an interesting problem, you go and talk to somebody and they might
help you with the solution.
And it was a kind of a fun environment too, in which people did strange things and often tweaking the bureaucracy
in one way or another.
So rebellious and in some kinds of ways.
In some ways, yeah, absolutely.
I think most people didn't take too kindly to the bureaucracy, and I'm sure the bureaucracy
put up with an enormous amount of what they didn't really want to.
So maybe to Lingar and a little bit, do you have a
sense of what the philosophy that characterizes Unix is the design, not just the initial, but just
carry through the years, just being there, being around it, what's the fundamental philosophy behind
the system? I think one aspect, the fundamental philosophy was to provide an environment that made it easy to write or easier
productive to write programs. So it was meant as a programmer environment. It wasn't meant specifically as something to do some other kind of job.
For example, it was used extensively for word processing, but it wasn't designed as a word processing system. It was used extensively for lab control
But it wasn't designed for that. It was used extensively
as a front end for big other systems, big dumb systems, but it wasn't designed for that. It was meant
to be an environment where it was really easy to write programs. That's a program which could be
highly productive. And part of that was to be a community. And there's some observation from Dennis
Ritchie. I think at the end of the book, it says that from his standpoint,
the real goal was to create a community
where people could work as programmers on a system.
And I think in that sense,
certainly for many, many years,
it succeeded quite well at that.
And part of that is the technical aspects
of because it made it really easy to write programs.
People did write interesting programs. Those programs tended to be used by other programmers.
And so it was kind of a virtuous circle of more and more stuff coming out that was really good
for programmers. And you were part of that community of programmers. So what was it like writing
programs on that early Unix? It was a blast, it really was. I like to program.
I'm not a terribly good programmer, but it was a lot of fun to write code.
And in the early days, there was an enormous amount of what you would today, I suppose,
called low hanging fruit.
People hadn't done things before, and this was this new environment and the whole combination
of nice tools and very responsive
system and tremendous colleagues made it possible to write code.
You could have an idea in the morning.
You could do it in an experiment with it.
You could have something limping along that night or the next day and people would react
to it and they would say, oh, that's wonderful, but you're really screwed up here.
And the feedback loop was then very, very short and tight.
And so a lot of things got developed fairly quickly that in many cases still exist today.
And I think that was part of what made it fun because programming itself is fun.
It's puzzle solving in a variety of ways.
But I think it's even more fun when you do something
that somebody else then uses.
Even if they whine about it, not working,
the fact that they used it is part of the reward mechanism.
And what was the method of interaction,
the communication that feedback loop?
I mean, this is before the internet.
Certainly before the internet.
It was mostly physical right there,
you know, somebody who came into your office
and say something.
So these places are all close by, like offices
that are nearby, so you're really lively
into interaction.
Yeah, yeah, no, Bell Labs was fundamentally
one giant building and most of the people
were involved in this unique stuff.
We're in two or three quarters and there was a room
of how big was it,? Probably call it 50 feet by 50 feet. Make up a number of that,
which had some access to computers there as well as in offices and people hung out there and it had a coffee machine.
And so there was, it was mostly very physical. We did use email, of course.
And but it was fundamentally all for a long time, all on one machine.
So there was no need for internet.
It's fascinating to think about what computing would be today without
about labs.
It seems so many people being in the vicinity of each other,
that sort of getting that quick feedback,
working together, some so many brilliant people.
I don't know where else that could have existed in the world.
I've been given how that came together.
What did that make you feel that that's
that little element of history?
Well, I think that's very nice,
but in a sense, it's survivor bias.
And if it hadn't happened at Bell Labs
There were other places that were doing really interesting work as well. Xerox Park is perhaps the most obvious one
Xerox Park contributed enormous amount of good material
And many of the things we take for granted today in the same way came from Xerox Park experience
I don't think they capitalized in the long run as much their parent company was perhaps not as lucky in
Capitalizing on this who knows but that would that certainly another place where there was a tremendous amount of
Influence there were a lot of good university activities
MIT was obviously no slouch in this kind of thing and and others as well
so unix this kind of thing and others as well. So Unix turned out to be open source because of the
various ways that AT&T operated and sort of had to, the focus was on telephones. So I think
that's a mischaracterization in the sense. It absolutely was not open source. It was very definitely proprietary, licensed, but it was licensed freely to universities.
In source code form for many years, and because of that, generations of university students and their
faculty people grew up knowing about UNIX, and there was enough expertise in the community that
it then became possible for people to kind of go off in their own direction and build something that looked unix-like.
The Berkeley version of unix started with that licensed code and gradually picked up enough
of its own code contributions, notably from people like Bill Joy, that eventually it was
able to become completely free of any AT&T code.
Now there was an enormous amount of legal jockeying around this in the late early-delate 80s, early
90s, something like that. And then, I guess the open source movement might have started when
Richard Stallman started to think about this in the late 80s.
And by 1991, when Torbald's decided he was going to do a Unix-like operating system,
there was enough expertise in the community that first he had a target, he could see what to do because the kind of the Unix system called interface and the tools and so on were there.
And so he was able to build an operating system that at this point when you say Unix,
in many cases, what you're really thinking is Linux. Linux, yeah. But it's funny that for my
distant perception, I felt that Unix was open source without actually knowing it, but what you're really
saying was just a freely licensed.
It was freely licensed.
So it felt open source because universities are not trying to make money.
So it felt open source in a sense that you can get access if you want it.
Right.
And a very, very, very large number of universities had the license and they were able to talk
to all the other universities who had the license and they were able to talk to all the other universities who had the license and so
Technically not open technically belonging to AT&T pragmatically pretty open
And so there's a ripple effect at all the faculty and students then I'll grew up and then
they went throughout the world and
Permade in that kind of way. So what kind of features do you think make for a good operating system?
If you take the lessons of Unix, you said make it easy for programmers. That seems to be
an important one, but also Unix turned out to be exceptionally robust and efficient.
but also, unix turned out to be exceptionally robust and efficient. Right. So, is that an accident when you focus on the programmer or is that a natural outcome?
I think part of the reason for efficiency was that it began on extremely modest hardware, very, very, very tiny.
And so, you couldn't get carried away. You couldn't do a lot of complicated things
because you just didn't have the resources,
either processor, speed, or memory.
And so that enforced a certain minimality of mechanisms and maybe a search for generalizations
so that you would find one mechanism that served for a lot of different things rather than
having lots of different special cases.
I think the file system in UNIX is a good example of that file system interface and its fundamental form is extremely
straightforward and that means that you can write code very, very effectively for the file system.
And then one of those idea, one of those generalizations is that gee, that file system interface works
for all kinds of other things as well. And so in particular, the idea of reading and writing
to devices is the same as reading and writing
to a disk that has a file system.
And then that gets carried further in other parts
of the world processes become in effect files
in a file system.
And the plan nine operating system, which came along,
I guess in the late 80s or something like that, took a lot of those ideas from the original Unix and tried to push the generalization
even further. So in Plan 9, a lot of different resources, hard file systems, they all share
that interface. So that would be one example where finding the right model of how to do something
means that an awful lot of things become simpler,
and it means therefore that more people can do useful, interesting things with them
without them to think as hard about it. So you said you're not a very good programmer.
You're the most modest human being, okay, but you'll continue saying that. I understand how this
works, but you do radiate a sort of love for programming.
So let me ask, do you think programming is more an art or science?
Is it creativity or kind of rigor?
I think it's some of each.
It's some combination.
Some of the art is figuring out what it is that you really want to do.
What should that program be?
What would make a good program?
And that's some understanding of what the task is, what should that program be? What would make a good program? And that's
some understanding of what the task is, what the people who might use this program want. And I think
that's art in many respects. The science part is trying to figure out how to do it well. And some of
that is a real computer science-y stuff, like what algorithm should we use at some point,
mostly in the sense of being careful to use algorithms that will actually work properly,
scale properly, avoiding quadratic algorithms when a linear algorithm should be the right thing,
that kind of more formal view of it, same thing for data structures. But also it's, I think an engineering field as well.
And engineering is not quite the same as science because engineering you're working with
constraints. You have to figure out not only, so what is a good algorithm for this kind of thing,
but what's the most appropriate algorithm given the amount of time we have to compute the amount
of time we have to program what's
likely to happen in the future with maintenance, who's going to pick this up in the future.
All of those kind of things that if you're an engineer, you get to worry about, whereas
if you think of yourself as a scientist, well, you can maybe push them over the horizon
in a way.
And if you're an artist, what's that?
So just on your own personal level, what's your process like writing a program?
Say a small and large sort of tinkering stuff.
Do you just start coding right away and just kind of evolve iteratively with a loose notion
or do you plan on a sheet of paper first and then kind of design in what they teach you in the
kind of software engineering courses and undergrad or something like that? What's your process like?
It's certainly much more the informal incremental. First, I don't write big programs at this point.
It's been a long time since I wrote a program that was more than, I call it a few hundred
or more lines, something like that. Many of the programs are right or experiments
for either something I'm curious about or often for something that I want to talk about in a class.
And so those necessarily tend to be relatively small. A lot of the kind of code I write these days
tends to be for sort of exploratory data analysis where I've got some collection of data and I want
to try and figure out what Earth is going on in it.
And for that, those programs tend to be very small.
Sometimes you're not even programming, you're just using existing tools like counting
things or sometimes you're writing ox scripts because two or three lines will tell you something
about a piece of data.
And then when it gets bigger, well, then I will probably write something in Python
because that scales better.
Up to call it a few hundred lines or something like that.
And it's been a long time since I wrote programs
that were much more than that.
Speaking of data exploration in OCC,
first, what is OCC?
So OCC is a scripting language that was done
by myself, L-A-O, on Peter Weinberger.
We did that originally in the late 70s.
It was a language that was meant to make it really easy to do quick and dirty tasks like counting things
or selecting the interesting information from basically all text files, rearranging it in some way or summarizing it.
Runs a command on each line or a file.
I mean, there's a, it's still exceptionally widely used today.
Oh, absolutely. Yeah.
It's so simple and elegant, sort of the way to explore data turns out you can just write
a script that does something seemingly trivial in a single line.
And that giving you that slice of the data somehow reveals something fundamental about
the data.
And that keeps, that seems to work still.
Yeah, it's very good for that kind of thing.
That's sort of what it was meant for.
I think what we didn't appreciate was that the model was actually quite good for a lot
of data processing kinds of tasks. And that it's kept going as long as it has because at this
point it's over 40 years old and it's still I think a useful tool and well this
is paternal interest I guess but I think in terms of programming languages you
get the most bang for the buck by learning awk and it doesn't scale the big
programs but it does pretty pretty darn well on these little
things where you just want to see all the somethings in something. So yeah, I find I probably
write more rock than anything else at this point. Well, so what kind of stuff do you love about
arc? Like is there, if you can comment on sort of things that give you joy when you can in a simple program reveal something about the
data. Is there something that stands out, some particular features? I think it's mostly the
selection of default behaviors. You sort of hint at it at a moment and go, what Octo is to read
through a set of files. And then within each file it writes through each of the lines and then on each of the lines
it has a set of patterns that it looks for that's your ARC program and
If one of the patterns matches there is a corresponding action that you might perform and so it's kind of a
quadruply nested loop or something like that
And that's all completely automatic. You don't have to say anything about it.
You just write the pattern and the action
and then run the data by it.
And so that paradigm for programming
is very natural and effective one.
And I think we captured that reasonably well in OCC.
And it does other things for free as well.
It splits the data into fields.
So that on each line, there is fields separated
by a white space or something.
And so it does that for free
You don't have to say anything about it
And it collects information. It goes along like what line are we on how many fields are there on this line
So lots of things that just make it so that a program which in another language
Let's say Python would be 5 10 20 lines in Arcus one or two lines.
So because it's one or two lines, you can do it on the shell.
You don't have to open up another whole thing.
You can just do it right there in the interaction with the operatives.
Just to tell you the right.
Is there other shell commands that you love over the years?
Like you really enjoy using the And major. Grap.
Grap.
The only one.
Yeah, Grap does everything.
So Grap is a kind of what is it a simpler version of OCC, I would say?
In some, in some sense, yeah, right, because.
What is Grap?
So Grap is it basically searches the input for particular patterns, regular expressions,
technically, of a certain class.
And it has that same paradigm that OCC does. It's a pattern action thing. It reads through all the files and then all the lines
in each file, but it has a single pattern,
which is the regular expression you're looking for
and a single action printed, if it matches.
So in that sense, it's a much simpler version
and you could write graphian Oc as a one-liner.
And I use graph probably more than anything else,
at this point, just because it's a single action could write Grappian Ock as a one-liner. And I use Grapp probably more than anything else
at this point just because it's so convenient and natural.
Why do you think it's such a powerful tool? Grappinock, why do you think operating systems
like Windows, for example, don't have it? Sort of, you can of course, I use which is amazing now. There's windows for Linux, which
you could basically use all the fun stuff like Alchemist and Grap in inside of windows,
but windows naturally, as part of the graphical interface, the simplicity of Grap searching
through a bunch of files and just popping up naturally. Why do you think that's unique to the Linux environment?
I don't know.
It's not strictly unique, but it's certainly focused there.
I think some of it's the weight of history that Windows came from MS-DOS.
MS-DOS was a pretty pathetic operating system, although common on unboundedly large number
of machines,
but somewhere in roughly the 90s, Windows became a graphical system.
And I think Microsoft spent a lot of their energy on making that graphical interface what
it is.
And that's a different model of computing.
It's a model of computing that, where you point and click and sort of experiment with menus. It's a model of computing that where you point and click and sort of experiment
with menus, it's a model of computing works. Right, rather well for people who are not
programmers. I just want to get something done whereas teaching something like the command
line to non-programmers turns out to sometimes be an uphill struggle. And so I think Microsoft
probably was right in what they did. Now, you mentioned whistle or whatever it's called the Winx Linux.
What's that?
I wonder what's been asked.
The WSL is what never actually pronounced the whistle.
I like it.
I have no idea.
But there have been things like that for long as Sigwin, for example,
which is a wonderful collection of take all your favorite tools from Unix and Linux
and just make them work perfectly on Windows.
And so that's something that's been going on for at least 20 years, if not longer.
And I use that on my one remaining Windows machine routinely, because it's for if you're
doing something that is batch computing, command, suitable for command line, that's the right
way to do it, because the Windows equivalents are if nothing else, not familiar to me.
But I should I would definitely recommend to people to if they don't use SIGMENT to try because the windows equivalents are, if nothing else, not familiar to me.
But I should, I would definitely recommend to people to, if they don't use SIGMENT to try whistle.
Yes.
I've been so excited that I could use bass,
I'd be bass, write scripts quickly in windows.
It's changed my life.
Okay, what's your perfect programming setup?
What computer, what operating system, what keyboard, what editor?
Yeah, perfect is too strong of word.
I'm just way too strong of word.
What I use by default, I have a, at this point, a 13-inch MacBook Air, which I use because
it's kind of a reasonable balance of the various things I need.
I can carry it around.
It's got enough computing, horse bars,
screens big enough, keyboards okay.
And so I basically do most of my computing on that.
I have a big iMac in my office that I use from time to time
as well, especially when I need a big screen,
but otherwise tends not to be used at much.
Editor, I use mostly SAM, which is an editor that Rob Pike wrote long ago
at Bell Labs. And...
Did that search interrupt? Does that proceed VI? Does that proceed max?
It posts dates both VI and Emax. It is derived from Rob's experience with ED and Vi.
That's the original unique editor.
Oh, wow.
Data probably before you were born.
So what's the history of editors?
Can you briefly...
This is your fact, I used EMEX, I'm sorry to say, sorry to come
out with that. But what's the kind of interplay there? So in ancient times, like call it the
first time sharing system is going back to what we were talking about. There were editors,
there was an editor on CTSS that I don't even remember what it was called, it might have been edit, where you could type text,
program text, and it would do something,
or a document text.
You could save the text.
Save it, you could edit it.
Yeah, the usual thing that you would get in an editor.
And Ken Thompson wrote an editor called QED,
which was very, very powerful,
but these were all totally a command based.
They were not most or cursor based
because it was before mice and even before cursors
because they were running on terminals that printed on paper.
Okay, no CRT type displays, little LED's.
And so then when Unix came along,
Ken took QED and stripped it way, way, way, way down.
And that became an editor that he called ED.
It was very simple, but it was a line oriented editor.
And so you could load a file, and then you could talk about the lines one through the last
line, and you could print ranges of lines.
You could add text, you could delete text, you could change text, or you could do a substitute
command that would change things within a line
or within groups of lines.
So you can work on parts of a file essentially.
You know, you work on any part of it,
the whole thing or whatever,
but it was entirely command line based
and it was entirely on paper, paper.
And that meant that you changed, yeah, right,
real paper.
And so if you changed the line,
you had to print that line using up another line of paper to see what change
CAUSE, okay. Yeah.
So when when CRT displays came along, yeah, then
You could start to use cursor control and you could sort of move where you were on the screen in
without reprinting every time printing and
without reprinting every time. Without reprinting.
And there were a number of editors there,
the one that I was most familiar with and still use,
is VI, which was done by Bill Troy.
And so that dates from probably the late 70s as a guess.
And it took a full advantage of the cursor controls.
I suspect that EMAX was roughly at the same time,
but I don't know.
I've never internalized Emax.
So at this point, I stopped using ED all I still can.
I use VIs.
Sometimes I use SAM when I can.
And SAM is available on most systems?
It is available.
You have to download it yourself from,
typically, the plan line operating system distribution.
It's been maintained by people there.
And so I get home tonight. I'll try it.
It's cool. It sounds, it sounds fascinating.
Although my love is with Lisbon, Emax, I've went into that hippie world of, I think it's a lot of things.
What religion were you brought up with? Yeah, that's true.
That's true.
Most of the actual programming I do is CC++ and Python, but my weird sort of, yeah, my
religious upbringing is endless.
So can you take on the possible task and give a brief history of programming languages
from your perspective?
So I guess you could say programming languages started probably in what the late 40s or something like that.
People used to program computers by basically putting in zeroes and ones using something like switches on a console.
And then, or maybe holes and paper tapes, something like that.
So extremely tedious, awful, whatever. And so I think the first programming languages
were relatively crude assembly languages
where people would basically write a program
that would convert nomonics like add ADD
into whatever the bit pattern was,
it corresponded to an add instruction,
and they would do the clerical work of figuring out where things were.
So you could put a name on a location in a program and the assembler would figure out where
that corresponded to when the thing was all put together and dropped into memory.
And early on, and this would be the late 40s and very early 50s, there were assemblers
written for the various machines
that people used.
You may have seen on the paper just a couple days ago,
Tony Berkard died.
He did this thing in Manchester called the Autocode,
a language which I knew only by name,
but it sounds like it was a flavor of assembly language,
sort of a little higher in some ways.
And it replaced the language that Alan Turing wrote, which you put in zero's and ones,
which put him in backwards order because that was a hardware work.
Very smart.
That's right.
Yeah, that's right.
Backwards.
So assembly languages, then let's call that the early 1950s.
And so every different flavor of computer has its own assembly language.
So the EdSAC had it, it's an a Manchester head it, and the IBM
whatever 7090 or 704 or whatever it is.
And so everybody had their own assembly language.
And assembly languages have a few commands,
additions, subtraction, and branching,
or some kind if then that was the situation.
Right.
They have exactly in their simplest form,
at least one instruction per, or one assembly
language instruction per instruction in the machine's repertoire. And so you have to know
the machine intimately to be able to write programs in it. And if you write an assembly language
program for one kind of machine and then you say, gee, it's nice. I'd like a different machine.
Start over. Okay. So very bad. And so what happened in the late 50s was people realized you could
play this game again and you could move up a level in writing or creating languages that were
closer to the way the real people might think about how to write code. And there were, I guess,
arguably three or four at that time period, there was Fortran, which came from IBM, which was formula translation,
meant to make it easy to do scientific and engineering computation.
I just know that formula translation. That's what I stood for.
It was Cobal, which is the common business-oriented language that Grace Hopper and others worked on,
which was aimed at business kinds of tasks. There was Alwell, which was mostly meant to describe
algorithmic computations.
I guess you could argue basic was in there somewhere.
I think it's just a little later.
And so all of those moved the level up.
And so they were closer to what you and I might think of as we were trying to write a program.
And they were focused on different domains, for Trans for Formula translation, engineering
computations, let's say, cobalt for business, that kind of thing.
And still used today.
So he's four-tron probably.
Oh, yeah.
Cobalt, too.
Come on.
But the deal was that once you moved up that level, then you, let's call it for Trans,
you had a language that was not tied to a particular kind of hardware because a different
compiler would compile for different kind of hardware. And that meant two things. It meant you only had to write the program once, which
was very important. And it meant that you could, in fact, if you were a random engineer,
physicist, whatever, you could write that program yourself. You didn't have to hire a programmer
to do it for you. It might not be as good as you'd get through a programmer, but it was pretty good.
And so it democratized and made much more broadly available.
They built it right code.
So it puts the power of programming to the hands of people like you.
Yeah.
Anybody who wants, who is willing to invest some time in learning A programming language
and is not then tied to a particular kind of computer.
And then in the 70s, you get system programming languages of which C is the survivor.
And what is system programming language?
Programming languages that would take on the kinds of things that would
necessarily write so-called system programs, things like text editors or assemblers
or compilers or operating systems themselves, those kinds of things.
And for a future rich, they have to be able to do a lot of stuff, a lot of memory management,
the access processes and all that kind of stuff.
They have a processing data.
It's a different flavor of what they're doing.
They're much more in touch with the actual machine in a, but in a positive way.
That is, you can talk about memory in a more controlled way.
You can talk about the different data types
that the machine supports in a way
they're and more ways to structure organized data.
And so the system programming languages,
there was a lot of effort in that
in the call it the late 60s or early 70s,
see as I think the only real survivor of that.
And then what happens after that,
you get things like object oriented programming languages
because as you write programs in a language like C,
at some point scale gets to you
and it's too hard to keep track of the pieces
and there's no guardrails or training wheels
or something like that to prevent you from doing bad things.
So C++ comes out of that tradition. And so then it took off from there. I mean, there's also a parallel, slightly parallel track
with a little bit of functional stuff, a list and so on. But I guess from that point,
it's just an explosion of languages. There's the Java story, there's the JavaScript,
there's all the stuff that the cool kids these days are doing with rust and all that.
all the stuff that the cool kids these days are doing with rust and all that.
So what's to use your, you wrote a book, see programming language,
what then sees probably one of the most important languages in the history of programming languages.
If you kind of look at impact, what do you think is the most elegant or powerful part of C?
Why did it survive? Why did it have such a long lasting impact?
I think it found a sweet spot that in of expressiveness, so you could really write things in a
pretty natural way and efficiency, which was particularly important when computers were not
nearly as powerful as they are today. You're going to put yourself back 50 years,
almost in terms of what computers could do.
That's roughly four or five generations,
decades of more as long, right.
So expressiveness and efficiency and I don't know,
perhaps the environment that it came with as well,
which was Unix.
So it meant if you wrote a program, it could be used on all those computers that ran Unix.
And that was all of those computers because they were all written in C. And that was Unix,
the operating system itself was portable as were all the tools. So it all worked together again.
And one of these things were things fed on each other in a positive cycle.
What did it take to write sort of a definitive book,
probably definitive book on all of the program,
like it's more definitive to a particular language
than any other book on any other language,
and did two really powerful things,
which is popularized the language,
at least from my perspective, maybe you can correct me.
And second is create a standard of how,
you know, the, how this language is supposed to be used
and applied.
So what did it take?
Did you have those kinds of ambitions in mind
when you're working on that?
Because it's some kind of joke.
Ha ha ha ha.
No, of course not.
So it's an accident of timing, skill, and just luck.
A lot of it is, skill, and just luck.
A lot of it is, clearly, timing was good. Now Dennis and I wrote the book in 1977.
And it's Reggie.
Yeah, right.
And at that point, Unix was starting to spread.
I don't know how many there were,
but it would be dozens to hundreds of Unix systems.
And C was also available on other kinds of computers
that had nothing to do with Unix,
and so the language had some potential.
And there were no other books on C, and Bell Labs was really the only source for it, and
Dennis, of course, was authoritative because it was his language, and he had written
the reference manual, which is a marvelous example of how to write a reference manual.
Really, really, very, very well done. So I twisted his arm until he agreed to write a book and then we wrote a book.
And the virtue or advantage, at. I mean, he really,
really did. And the reference manual in that book is his period. I had nothing to do with
that at all. So just crystal clear prose and very, very well expressed. And then he and I,
I wrote most of the expository material. And then he and I sort most of the expository material
and then he and I sort of did the usual ping ponging
back and forth refining it.
But I spent a lot of time trying to find examples
that would sort of hang together
and that would tell people what they might need to know
at about the right time that they should be thinking
about needing it.
And I'm not sure it completely succeeded,
but it mostly worked out fairly well.
What do you think is the power of example?
I mean, you're the creator, at least one of the first people to do the Hello World program,
which is like the example.
If aliens discover our civilization hundreds of years from now, it'll probably be Hello World
programs, just to have broken robot
communicating with them with the hello world. So what and that's a representative example. So what
what do you find powerful about examples? I think a good example will tell you how to do something
and it will be representative of you might not want to do exactly that, but you will want to do something that's at least in that same general vein.
And so a lot of the examples in the C book were picked for these very, very simple, straightforward text processing problems that were typical of Unix.
I want to read input and write it out again. There's a copy command. I want to read input and do something to it and write it out again.
There's a grab. And so that kind of find things that are representative of what people want to do
and spell those out so that they can then take those and see the the core parts and modify them
to their taste. And I think that a lot of programming books that I,
I don't look at programming books at tremendous amount these days,
but when I do, a lot of them don't do that.
They don't give you examples that are both realistic
and something you might want to do.
Some of them are pure syntax.
Here's how you add three numbers.
Well, come on, I could figure that out.
Tell me how I
would get those three numbers into the computer and how it would do something useful with them,
and then how I put them back out again, neatly formatted. And especially if you follow that example,
there's something magical of doing something that feels useful. Yeah, right. And I think it's
the attempt, and it's absolutely not perfect. but the attempt in all cases was to get something
that was going to be either directly useful or would be very representative of useful
things that a programmer might want to do.
But within that vein of fundamentally text processing, reading text, doing something,
writing text.
So you've also written a book on Go language that I've to admit so I
worked at Google for a while and I'm never used to go. Not you miss something. Well I
know I miss something for sure. I mean it's so go and rust the two languages that I
hear very spoken very highly of and I wish I would like to. Well there's a lot of
them. There's Julia.
There's all these incredible modern languages.
But if you can comment before, or maybe comment on what do you find, where does ghost
sit in this broad spectrum of languages?
And also, how do you yourself feel about this wide range of powerful, interesting languages
that you may never even get to try to explore.
Yeah.
Because of time.
So I think, so go first comes from that same Bell Labs tradition in part, not exclusively,
but two of the three creators, Ken Thompson and Rob Pike.
So literally the people.
Yeah, the people.
And then with this very, very useful influence from the European
school in particular, the closed sphere influence through Robert Griesmer, who was, I guess, a second
generation down student at ETH. And so that's an interesting combination of things. And so some
ways go captures the good parts of C. It looks sort of like C. It's
sometimes characterized as C for the 21st century. On the surface, it looks very, very much
like C. But at the same time, it has some interesting data structuring capabilities.
And then I think the part that I would say is particularly useful. And again, I'm not a go expert.
In spite of co-authoring the book, about 90% of the work was done by Alan Donovan, my co-author,
who is a go expert. But go provides a very nice model of concurrency. It's basically the cooperating,
communicating sequential processes, the Tony Hore set forth, I don't know,
40 plus years ago. And go routines are, to my mind, a very natural way to talk about parallel
computation. And in the few experiments I've done with them, they're easy to write, and typically,
it's going to work, and very efficient as well. So I think that's one place where
Go stands out to that model of parallel computation. It's very easy and nice to work with.
Just a comment on that. Do you think C for saw or the early Unix days for saw threads and massively
parallel computation? I would guess not really. I mean, maybe it was seen, but not at the level where it was
something you had to do anything about.
For a long time, processors got faster, and then processors stopped getting faster because
of things like power consumption and heat generation.
And so what happened instead was that instead of
processing is getting faster, there started to be more of them. And that's where that parallel thread
stuff comes in. So if you can comment on all the other languages, is it break your heart,
you'll never get to explore them? How do you feel about the full variety? It's not break my heart, but I would love to be able to try more of these
languages. The closest I've come is in a class that I often teach in the spring
here. It's a programming class. And I often give I have one sort of small
example that I will write in as many languages as I possibly can. I've got it in 20 odd languages at this point.
And that's so I do a minimal experiment with a language just to say,
okay, I have this trivial task, which I understand the task.
And it takes 15 lines in OCC and not much more in a variety of other languages.
So how big is it?
How fast does it run?
And what pain did I go through to learn how to do it?
And that's a, it's like anecdote, right? It's a very, very, very narrowly-
Fultata, I like that term. So yeah, but still it's a little sample, because you get the,
I think the hardest step of the programming language is probably the first step, right? So they're you're taking the first step.
Yeah, and so my experience with some languages is very positive, like Lua, a scripting language
I had, you never used.
And I took my little program, the program is a trivial formatter.
It just takes in lines of text of varying lengths and it puts them out in lines that have
no more than 60 characters
on each line. So think of it as just kind of the flow of process in a browser or something.
So it's a very short program. And in Lua, I downloaded Lua and in an hour I had it working,
never having written Lua in my life, just going with online documentation. I did the same
thing in Scala, which you can think of as a flavor of Java
Equally trivial. I did it in Haskell. It took me several weeks
But it did run like a turtle
and
And I I did it in Fortran
90 and it wow painful, but it worked and I tried it in Rust and it took me several days to get it working because the model of memory management
It was just a little unfamiliar to me and the problem I had with Rust and it's back to what we were just talking about
I couldn't find good consistent documentation on Rust now this was several years ago
And I'm sure things have stabilized but at the time
Everything in the Rust world seemed to be changing rapidly.
And so you would find what looked like a work in the example,
and it wouldn't work with the version of the language that I had.
So it took longer than it should have.
Rust is a language I would like to get back to, but probably won't.
I think one of the issues you have to have something you want to do.
And if you don't have something that is the right combination of I want to do it,
and yet I have enough disposable time, whatever, to make it worth learning a new language at the same
time, it's never going to happen. So what do you think about another language of JavaScript? That's this,
well, let me just sort of comment on what I said. So what I was brought up, sort of JavaScript,
but seen as the, probably like the ugliest language possible.
And yet it's quite arguably, quite possibly taking over
not just the front end, the back end of the internet, but
possibly in the future, taking over everything, because they've
now learned to make it very efficient.
Yeah.
And so what do you it very efficient. Yeah.
And so what do you think about this?
Yeah, well, I think you captured it in a lot of ways.
When it first came out, JavaScript was deemed to be fairly
irregular and an ugly language.
And certainly in the academy, if you said you were working
on JavaScript, people would ridicule you.
It was just not fit for academics to work on.
I think a lot of that has evolved.
The language itself has evolved.
And certainly the technology of compiling it
is fantastically better than it was.
And so in that sense, it's absolutely a viable solution
on back ends as well as the front ends used well.
I think it's a pretty good language.
I've written a modest amount of it
and I've played with JavaScript translators and things like that. I'm written a modest amount of it and I've played with JavaScript
translators and things like that. I'm not a real expert and it's hard to keep up
even there with the new things that come along with it. So I don't know whether
it will ever take over the world I think not, but it's certainly an important
language and we're just knowing more about.
There's maybe to get a comment on something which JavaScript and actually most languages
are Python, such a big part of the experience of programming with those languages includes
libraries.
So, using building on top of the code that other people have built, I think that's probably
different from the experience that we just talked about from
Unix and C-days when you're building stuff from scratch.
What do you think about this world of essentially leveraging building up libraries on top
of each other and leveraging them?
Yeah, that's a very perceptive kind of question.
One of the reasons programming was fun in the old days was that you were really building
it all yourself.
The number of libraries you had to deal with was quite small.
Maybe it was print-out for the standard library or something like that.
And that is not the case today.
And if you want to do something in, you mentioned Python and JavaScript and those of the two
finding examples, you have to typically download a boatload of other stuff and you
have no idea what you're getting.
Absolutely nothing.
I've been doing some playing with machine learning over the last couple of days and G
something doesn't work.
Well, you pip install this and down comes another gazillion megabytes of something and you
have no idea what it was.
And if you're lucky, it works.
And if it doesn't work, you have no recourse.
There's absolutely no way you could figure out which in these thousand different packages.
And I think it's worse in the MPM environment for JavaScript.
I think there's less discipline, less control there.
And there's aspects of not just not understanding how it worked, but there's security issues, there's robustness issues, so you don't want to run a nuclear power plant using JavaScript, essentially.
Probably not.
So speaking to the variety of languages, do you think that variety is good or do you
hope think that over time we should converge towards one, two, three programming languages
that you mentioned
to the Bell odd days when people could sort of the community of it. And the more languages
you have, the more you separate the communities, there's the Ruby community, there's the Python
community, there's C++ community. Do you hope that they'll unite one day to just one
or two languages?
I certainly don't hope it. I'm not sure that that's right because I honestly don't think
there is one language that will suffice for all the programming needs of the world. Are
there too many at this point? Well, arguably, but I think if you look at the distribution
of how they are used, there's something called a dozen languages that probably account for 95% of all programming at this point.
And that doesn't seem unreasonable. And then there's another, well, 2000 languages that are still in use,
that nobody uses and, or at least don't use in any quantity.
But I think new languages are a good idea in many respects, because they're often a chance to explore an idea of
How language might help? I think that's one of the
Positive things about functional languages for example. They're a particularly good place where people have explored
ideas
That at the time
Didn't seem feasible, but ultimately have wound up as part of mainstream
languages as well.
I mean, just go back as early as recursion and Lisp and then follow forward.
Functions as first class citizens and pattern-based languages.
And gee, I don't know, closures and just on and on and on.
Laptops.
Interesting ideas that showed up first in, let's call it broadly,
the functional programming community and then find a way into mainstream languages.
Yeah, it's a playground for rebels. Yeah, exactly.
And so I think the languages in the playground themselves are probably not going to be the mainstream,
at least for some while, but the ideas that come from there are invaluable.
So let's go to something that when I found out recently,
so I've known you've done a million things,
but one of the things I wasn't aware of,
that you had a role in ample.
And before you interrupt me by minimizing your role in it,
which is a hamper list for minimizing functions.
Yeah, minimizing functions, right exactly.
Can I just say that the elegance and abstraction power of ample is incredible.
When I first came to it about 10 years ago or so, can you describe what is the ample
language?
Sure.
So ample is a language for mathematical programming, technical
term, think of it as linear programming. That is setting up systems of linear equations
that are, of some sort of system of constraints. So that you have a bunch of things that have
to be less than this greater than that, whatever. And you're trying to find a set of values
for some decision variables that will maximize or minimize some objective function.
So it's a way of solving a particular kind of optimization problem, a very formal sort of optimization problem,
but one that's exceptionally useful.
And it specifies there's objective functions, constraints, and variables that become separate from the data that operates on.
Right.
So that kind of separation allows you to put on different hats when put the hat of an optimization person and then put another hat of a data person and dance back and forth and also separate the actual
solvers, the optimization systems that do the solving that you can have other people come to the table and then build their solvers whether it's linear or non-linear
Convex non-convex that kind of stuff. So
what is the Do you as maybe you can comment how you got into that world and what is the
beautiful or interesting idea to you from the world of optimization?
Sure.
So I, preface it by saying I'm absolutely not an expert on this.
And most of the important work in ample comes from why two partners in crime on that, Bob
Forer, who was a professor of and in the industrial
engineering and management science department at Northwestern and my colleague at Bellab's Dave Gay
who was a numerical analyst and optimization person. So the deal is linear programming.
Preferess this by saying, let's say, linear program. Yeah, linear program is the simplest example
of this. So linear program is taught in school is that you have a big matrix,
which is always called A, and you say AX is less than or equal to B.
So B is a set of constraints, X is the decision variables,
and A is how the decision variables are combined
to set up the various constraints.
So A is a matrix and X and B are vectors. And then there's
an objective function, which is just a sum of a bunch of X's and some coefficients on them. And
that's the thing you want to optimize. The problem is that in the real world, that matrix A is a
very, very, very intricate, very large and very sparse matrix, where the various components of the model are distributed
among the coefficients in a way that is totally unobvious to anybody. And so what you need is some
way to express the original model, which you and I would write mathematics on the board,
and the sum of this is greater than the sum of that kind of thing. So you need a language to write those kinds of constraints.
And Bob Forer for a long time had been interested in modeling languages, languages that made it possible to do this.
There was a modeling language around called GAMS, the General Elisbury Modeling System, but it looks very much like Fortran, it was kind of clunky. And so Bob spent a sabbatical year at Bell Labs in 1984. And he and,
there's any of the office across from me and always geography. And he and Dave Gay and I started
talking about this kind of thing. And he wanted to design a language that would make it so that you
could take these algebraic specifications, you know, summation signs over sets, and that you would write on the board and convert them into basically
this A matrix. And then pass that off to a solver, which is an entirely separate thing.
And so we talked about the design of the language. I don't remember any of the details of this
now, but it's kind of an obvious thing.
You're just writing out mathematical expressions in a 4-trend like, sorry, an algebraic, but
textual like language.
And I wrote the first version of this ample program, my first C++ program.
And it's written in C++. And so I did that fairly quickly. We wrote, it was
was, you know, 3000 lines or so. So it wasn't very big, but it sort of showed the feasibility of it
that you could actually do something that was easy for people to specify models and converted into
something that a solver could work with at the same time as you say that model and the data are
separate things. So one model would then work with all kinds work with, at the same time as you say, the model and the data are separate things.
So one model would then work
with all kinds of different data
in the same way that lots of programs
do the same thing, but with different data.
So one of the really nice things
is the specification of the models,
human, just kind of like as you say, is human readable.
Like I literally, I'm urban stuff I worked,
I would send it to colleagues
that I'm pretty sure never programmed
in their life just to understand what optimization problem is. I think how hard is it to convert
that? You said there's a first prototype in C++ to convert that into something that could actually
be used by the solver. It's not too bad because most of the solvers have some mechanism that lets them
import a model in a form. It might be as simple as the matrix itself in just some representation,
or if you're doing things that are not linear programming, then there may be some mechanism that
you provide things like functions to be called or other constraints on the model. So all ample does is to generate that kind of thing
and then solver deals with all the hard work.
And then when the solver comes back with numbers,
ample converts those back into your original forms
so you know how much of each thing you should be buying
or making or shipping or whatever.
So we did that in 84 and I haven't had a lot to do
with its ins except that we wrote a couple versions
of a book on it, which is one of the greatest books
ever written.
I love that book.
I don't know why.
It's an excellent book, Bob for wrote most of it.
And so it's really, really well done.
He must have been a dynamite teacher.
And type said in late tech.
No, no, no, are you kidding?
I remember liking the typography. So I don't know, we did it with
D.R.F. I don't even know what that is.
Yeah, exactly.
You're too young.
I think of D.R.F. as a predecessor to the tech family of things.
It's a formatter that was done at Bell Labs in this same period of
the very early 70s
that predates tech and things like that play
five to ten years. It was nevertheless. I'm going by memories. I remember it being beautiful.
Yeah, it was nice.
Outside of Unix, C, A, G, all the things we talked about, all the amazing work you've done. You've also done
working graph theory. Let me ask this crazy out there question. If you had to make a bet
and I had to force you to make a bet, do you think P equals NP?
The answer is no, although I told that somebody asked Jeff Dean if that was the under what conditions be would equal in P and he said either P is zero or in his one.
Or vice versa, I've forgotten.
This is what Jeff Dean is a lot smarter than I am.
So, but your intuition is I have no.
I have no intuition, but I've got a lot of colleagues who've got intuition and their betting is no.
That's the popular bet.
That's the popular bet.
Okay.
So, what is computation complexity theory?
And do you think these kinds of complexity classes, especially as you've taught in this
modern world, are still useful way to understand the hardness of problems?
I don't do that stuff.
The last time I touched anything to do with that, many years ago, was before it was
invented because it's literally true.
I did my PhD thesis on graph before big on notation.
Oh, absolutely.
Before I did this in 1968, and I worked on graph partitioning, which is this
question, you've got a graph that is a nodes and edges kind of graph.
And the edges have weights.
And you just want to divide the nodes into two piles of equal size.
So that the number of edges that goes from one side to the other is as small as possible.
And we developed so that problem is hard.
Well, as it turns out, I worked with Shen Lin at Bell Labs on this,
and we were never able to come up with anything that was guaranteed to give the right answer.
We came up with heuristics that worked pretty darn well,
and I peeled off some special cases for my thesis, but it was just hard.
And that was just about the time that Steve Cook was showing that there were classes of problems
that appeared to be really hard, of which graph partitioning was one.
But this, my expertise, such as it was totally predates that development.
Oh, interesting.
So the heuristic, which now, it was, it was, it was, it cares the two of yours names for
the tri-challenged salesman problem and for the graph partitioning.
That was, like, how did you, you weren't even
thinking in terms of classes, you were just trying to find a-
There was no such idea.
A heuristic that kind of does the job pretty well.
You were trying to find something that did the job and there was
nothing that you would call, let's say, a closed form or algorithmic thing that would
give you a guaranteed right answer. I mean, compare graph partitioning to max flow min cut or something like that. That's
the same problem except there's no constraint on the number of nodes on one side or the other of
the cut. And that means it's an easy problem. At least as I understand it, whereas the constraint
that says the two have to be constrained in size makes it a hard problem. Yes, so the rubber frost has that poem we have to choose to pass. So what
did you... Is there another alternate universe in which you pursued the Don Canuth path of
you know algorithm designs that have not smart enough? That's smart enough. You're infinitely modest, but so you've
pursued your kind of love of programming.
I mean, when you look back to those,
I mean, just looking into that world,
does that just seem like a distant world
of theoretical computer science?
Then is it fundamentally different
from the world of programming?
I don't know.
I mean, certainly in all seriousness,
I just didn't have the talent for
it. When I got here as a grad student in Princeton, and when I started to think about research at the
end of my final first year or something like that, I worked briefly with John Hopgraft, who is
absolutely, you know, you mentioned during a word winner, etc. a great guy. And it became crystal
clear I was not cut out for this stuff period. Okay. And so I moved
into things where I was more cut out for it and that tended to be things like writing programs
and then ultimately writing books. You said that in Toronto is an undergrad you did a senior thesis or literature survey on artificial intelligence. This was 1964.
Correct. What was the AI landscape ideas, dreams at that time?
I think that was one of the, well, you've heard of AI winners. This is whatever the opposite was
AI summer or something. It was one of these things where people thought that boy, we could do anything with
computers that all these hard problems we could computers will solve them. They will do
machine translation. They will play games like chess that they will do mission, you know,
prove theorems in geometry. There are all kinds of examples like that where people thought, boy, we could really do those sorts of things.
And, you know, I read The Cool Aid in some sense.
It's a wonderful collection of papers called Computers and Thought that was published in
about that era.
And people were very optimistic.
And then, of course, it turned out that what people thought was just a few years down the pike was more
than a few years down the pike.
And some parts of that are more or less now sort of under control.
We finally do play games like Go and Chess and so on better than people do, but there
are others.
Unmachine translation is a lot better than it used to be, but that's 50 close to 60 years of progress.
And a lot of evolution in hardware and a tremendous amount more data upon which you can build
systems that actually can learn from some of that.
And the infrastructure to support developers working together, like an open source movement,
the internet period is also an empowering. But what
lessons do you draw from that, the opposite of winter, that optimism?
Well, I guess the lesson is that in the short run, it's pretty easy to be too pessimistic
or maybe too optimistic and in the long run, you probably shouldn't be too pessimistic.
I'm not saying that very well.
It reminds me of this remark from Arthur Clark,
science fiction author who says,
you know, when some distinguished Bidelbergly person says
that something is possible, he's probably right.
And if he says it's impossible,
he's almost surely wrong.
But you don't know what the time scale is.
So the time scale is critical, right?
So what are your thoughts on this new summer of AI now
in the work with machine learning and neural networks?
You've kind of mentioned these started
to try to explore and look into this world
that seems fundamentally different from the world
of heuristics and algorithms like search
that it's now purely sort of trying to take huge amounts of data and learn
Learn from that data right programs from the data. Yeah, I look. I think it's very interesting. I am
Incredibly far from an expert most of what I know I've learned from my students and
They're probably disappointed in how little I've learned from them. But I think it has tremendous potential for certain kinds of things.
I mean, games is one where it obviously has had any effect on some of the others as well.
I think there's, and this is speaking from definitely not expertise, I think there are
serious problems in certain kinds of machine learning, learning at least because what they're
learning from is the data
that we give them. And if the data we give them has something wrong with it, then what they learn from
it is probably wrong too. And the obvious thing is some kind of bias in the data that the data has
stuff in it like I don't know. Women aren't as good as men as men at something. Okay. That's just flat wrong. But if it's in the data because of
historical treatment, then that machine learning stuff will propagate that. And that is a serious
worry. The positive part of that is what machine learning does is reveal the bias and the data and put some mirror to our own society. And so doing helps us
remove the buy, you know, helps us work on ourselves, puts a mirror to ourselves.
Yeah, that's an optimistic point of view. And if it works that way, that would be absolutely great.
And what I don't know is whether it does work that way or whether the AI mechanisms,
or machine learning mechanisms, reinforce and amplify things that have been wrong in the past.
And I don't know, but I think that's a serious thing
that we have to be concerned about.
Let me ask you an other question.
OK, I know nobody knows, but what do you think it takes
to build a system of human level intelligence?
That's been the dream from the 60s.
We talk about games, about language, about image recognition,
but really the dream is to create human level,
or superhuman level intelligence.
What do you think it takes to do that?
And are we close?
I haven't a clue and I don't know.
Roughly speaking.
I mean, this was very tricky into a hypothesis.
I mean, Turing talked about this and he just paper on machine intelligence back and,
she's on an early 50s or something like that.
And he had the idea of the Turing test.
And I don't know what the Turing test is.
It's a good test of intelligence.
I don't know.
It's an interesting test.
At least in some vague sense objective, whether you can read anything into the conclusions is a different story.
Do you have worries, concerns, excitement about the future of artificial intelligence?
So there's a lot of people who are worried, and you can speak broadly than just artificial
intelligence is basically computing, taking over the world in various forms.
Are you excited by this future, this
possibility of computing being everywhere, or are you worried?
At some combination of those, I think almost all technologies over the long run are for
good, but there's plenty of examples where they haven't been good, either over a long run for some people
or over a short run and computing is one of those
and AI within it is gonna be one of those as well,
but computing broadly, I mean,
for just a today example, this privacy,
that the use of things like social media
and so on means that and the commercial surveillance
means that there's an enormous amount more known about us by people, other businesses,
government, whatever, than perhaps one ought to feel comfortable with. So that's an example.
So that's an example of possible negative effect of computing being everywhere.
It's an interesting one because it could also be a positive leverage correctly.
There's a big if there.
So I have a deep interest in human psychology and humans seem to be very paranoid about
this data thing, but that varies depending on age group.
It seems like the younger folks, so it's exciting to me to see what society looks like 50 years from
now that the concerns about privacy may be flipped and they're had based purely in human psychology versus
actual concerns or not. What do you think about Moore's law? You said a lot of stuff
we've talked about with programming languages in their design and their ideas are come from
the constraints and the systems they operate. Do you think Moore's law, the exponential
improvement of systems, will continue indefinitely. There's
there's a mix of opinions on that currently or do you think do you think there
will be a plato? Well the frivolous answer is no exponential can go on forever.
You run out of something. Just as we said, timescale matters. So if it goes on long enough, that might be all we need.
Yeah, right.
What matters to us?
So I don't know.
We've seen places where Moore's law has changed.
For example, mentioned earlier, processors don't get
faster anymore.
But you use that same growth of, you know,
the ability to put more things in a given area to grow them horizontally instead of
vertical as it were. So you can get more and more processors or memory or whatever on the same chip.
Is that going to run into a limitation presumably because, you know, at some point you get down to
the individual atoms. And so you've got to find some way around that. Will to find some way around that will we find some way around that? I don't know. I just said that if I say it won't I'll be wrong
Perhaps we will so I just talked to Jim Keller and he says so he actually describes
He argues that the Moore's law will continue for a long long time because you mentioned the atom
We actually have I think a thousand fold increased still pot
Degrees in Trenton chances are size still possible before we get to the quantum level
So it's there's still a lot of possibilities. You think so continue and definitely which is an interesting optimistic
Optimistic viewpoint, but how do you think the programming languages will change with this increase?
Whether we hit a wall or not, what do you think?
Do you think there'll be a fundamental change in the way programming languages are designed?
I don't know about that. I think what will happen is continuation of what we see in some
areas, at least, which is that more programming will be done by programs than by people, and that more will be done by sort of declarative rather than procedural mechanisms, where I say, I want this to happen.
You figure out how. at this point, domain of specialized languages for narrow domains, but you can imagine that
broadening out. And so I don't have to say so much in so much detail, some collection of software,
what's called it, languages or programs or something, will figure out how to do what I want to do.
Oh, she thinks so increased levels of abstraction. Yeah.
And one day getting to the human level,
we're going to just use that.
It would be possible.
So you taught Stoke Teach a course,
computers in our world here at Princeton
that introduces computing and programming to not majors.
What, just from that experience, what advice
do you have for people who don't know anything
about programming, but I'm kind of curious about this world, or programming seems to become
more and more of a fundamental skill that people need to be at least aware of.
Yeah, well I can recommend a good book. What's that? The book I wrote for the course.
I think this is one of these questions of should everybody know how to program.
And I think the answer is probably not, but I think everybody should at least understand sort of
what it is so that if you say to somebody, I'm a programmer, they have a notion of what that might
be, or if you say this is a program, or this was decided by a computer running a program that they
have some vague intuitive understanding and accurate understanding of what that might imply.
So part of what I'm doing in this course, which is very definitely for non-technical people,
I mean, typical person in it is a history or English major.
Try and explain how computers work, how they do their thing, what programming is, how you write a program,
and how computers talk to each other, and what do they do when they're talking to each
other.
And then I would say nobody, very rarely, and it does anybody in that course go on to
become a real serious programmer, but at least they've got a somewhat better idea of
what all this stuff is about, not just the programming, but the least they've got a somewhat better idea of what all this stuff is
about, not just the programming, but the technology behind computers and communications.
Do they try and write a program themselves?
Oh, yeah.
Yeah, very small amount.
I introduce them to how machines work at a level below high level languages.
So we have a kind of a toy machine that has a very small repertoire, it doesn't instructions,
and they write trivial assembly language programs for that.
Wow.
So, if you were to give a flavor to people of the programming world,
for the competing world, what are the examples it should go with?
So, a little bit of assembly to get a sense at the lowest level of what the program is really doing.
Yeah, I mean, in some sense, there's no such thing as the lowest level because you can keep going down,
but that's the place where I drew the line.
So the idea that computers have a fairly small repertoire of very simple instructions that they can do,
like I hadn't subtracted and branched and so on, as you mentioned earlier. And that you can write code at that level
and it will get things done.
And then you have the levels of abstraction
that we get with higher level languages,
like Fortran or C or whatever.
And that makes it easier to write the code
and less dependent on particular architectures.
And then we talk about a lot of the different kinds
of programs that they use all the time
that they don't probably realize our programs,
like they're running macOS on their computers
or maybe Windows and they're downloading apps
on their phones and all of those things are programs
that are just what we just talked about
except at a grand scale. And it's easy to forget that there are actual programs that people program. There's engineers
that wrote those things.
Yeah, right. And so in a way, I'm expecting them to make an enormous conceptual leap from
their fiber-ten line toy assembly language thing that adds two or three numbers to you know something that is a browser on their phone or whatever but but it's really the same thing
So if you look at the broad and broad strokes at history
What do you think the world like how do you think the world changed because of computers?
It's hard to sometimes see the big picture when you're in it. Yeah. But I guess I'm asking if there's something you've noticed
over the years that like you were mentioned,
the students are more distracted looking at their,
now there's a device to look at.
Right.
Well, I think computing has changed the tremendous amount,
and obviously, but I think one aspect of that
is the way that people interact with each other
both locally and far away.
And when I was, you know, the age of those kids, making a phone call to somewhere was a big
deal because it costs serious money. And this was in the 60s, right? And today, people don't make
phone calls, they send texts, or something like that. So's up up and down in what people do. People
think nothing of having correspondence, regular meetings, video, whatever with friends or
family or whatever in any other part of the world. And they don't think about that at all.
And so that's just the communication aspect of it. And do you think that brings us closer together, or does it make us...
Does it take us away from the closeness of human-human contact?
I think it depends a lot on all kinds of things.
So I trade mail with my brother and sister in Canada much more often than I used to talk to them on the phone.
So probably every two or three days,
I get something or send something to them.
Whereas 20 years ago,
I probably wouldn't have talked to them on the phone
nearly as much.
So in that sense, I brought my brother and sister
and I closer together, that's a good thing.
I watch the kids on campus and they're mostly
walking around with their heads down, fooling with their phones to the point where I have to duck them.
Yeah. I don't know that that has brought them closer together in some ways. There's
sociological research that says people are in fact not as close together as they used to be.
I don't know where that's really true, but I can see potential downsides and kids where you think, come on, wake up
with a smell, a coffee or whatever. That's right. But if you look at, again, nobody can predict
the future, but are you excited? Kind of touch this a little bit with AI, but are you excited by the future in the next
10, 20 years, the computing will bring your there when there was no computers really.
And now computers are everywhere all over the world and Africa and Asia and just every
person, almost every person in the world has a device.
So are you hopeful, optimistic about that future?
It's mixed if the truth be told.
I mean, I think there are some things about that are good.
I think there's the potential for people
to improve their lives all over the place,
and that's obviously good.
And at the same time, at least in the short time,
short run, you can see lots and lots of bad
as people become more tribalistic
or parochial in their interests, and it's an enormous amount more us than them.
And people are using computers in all kinds of ways to mislead or misrepresent or flat
out lie about what's going on.
And that is affecting politics locally.
And I think everywhere in the world.
Yeah.
The long-term effect on political systems and so on.
It's who knows. Who knows indeed? The people now have a voice, which is a powerful thing.
People who are oppressed have a voice, but also everybody has a voice. And the chaos that
emerges in that is fascinating to watch. Yeah, it's kind of scary. If you can go back and relive a moment in your life,
one that made you truly happy outside of family or was profoundly transformative,
is there a moment, a moment that jump out at you for memory?
I don't think specific moments.
I think there were lots and lots and lots of good times
at Bell Labs where you would build something
and it worked.
Huh, Jason, it worked.
So the moment it worked.
So the moment it worked.
Yeah, and somebody used it and they said,
gee, that's neat.
Those kinds of things happened quite often
in that sort of golden era.
In the 70s when Unix was young and there
was all this low hanging fruit and interesting things to work on.
I grew up with people who kind of we were all together in this and if you did something
they would try it out for you.
And I think that was in some sense a really, really good time.
And Ock was an example of that.
Yeah. When you built it and people
used it. Yeah, absolutely. And now millions of people use it. And all your stupid mistakes
are right there for them to look at. So it's mixed. Yeah, it's terrifying, vulnerable, but
it's beautiful because it does have a positive impact on so many people. So I think there's
no better way to end it, Brian. Thank you so much for
talking to me. It was an honor. Okay. My pleasure. Good fun.
Thank you for listening to this conversation with Brian Kernigan and thank you to our sponsors.
H sleep mattress and Raycon earbuds. Please consider supporting this podcast by going to a sleep dot com slash Lex and to buy rake on
dot com slash Lex.
Click the links by the stuff.
These both are amazing products.
It really is the best way to support this podcast and the journey I'm on.
It's how they know I sent you and increases the chance that they'll actually support this
podcast in the future.
If you enjoy this thing, subscribe on YouTube, review it with 5,000 Apple podcasts, support
it on Patreon, or connect with me on Twitter, Alex Friedman, spelled somehow miraculously
without the letter E, just F-R-I-D-M-A-N, because when we immigrated to this country, we were
not so good at spelling.
And now, let me leave you with some words from Brian Kernigan.
Don't comment bad code.
We write it.
Thank you.