Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming | Lex Fridman Podcast #109
O9upVbGSBFo • 2020-07-18
Transcript preview
Open
Kind: captions
Language: en
the following is a conversation with
Brian Kernighan 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 Ritchie he co-authored the C
programming language with Dennis Ritchie
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 awk 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 his 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 - new sponsors
the amazing self cooling 8 sleep
mattress and rake on earbuds please
consider supporting the podcast by going
to 8 sleep complex and going to buy a
rake on comm slash flex click the links
buy the stuff it really is the best way
to support this podcast and a journey
I'm on if you enjoy this thing subscribe
on youtube review it with fire stars an
apple podcast supported 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 8
sleep and it's incredible pod Pro
mattress you can checkout at 8 sleep
calm slash flex to get $200 off the
mattress controls temperature with an
app and can cool down to as low as 65
degrees
research shows the temperature has a big
impact on the quality of our asleep
anecdotally he's been a game changer for
me I love it
the
patro 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 apps 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
calm slash flex to get $200 off this
show is also sponsored by Ray con
earbuds get them at buy rake on Comm
slash flex they've quickly become a main
method of listening to podcasts
audiobooks and music when I run do the
push ups and pull ups that have begun to
hate at this point or just living life
in fact I often listen to brown noise
with these what 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 play time 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 cardi B is but her earbud game
is on point to mention celebrities
actually care about
I'm sure if Richard Fineman was still
with us he'd be listening to the Joe
Rogan experience with Rick on earbuds
get them at by Drake on comm / Lex
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 the links it
really helps this podcast and now here's
my conversation with Brian Kernighan
started being developed fifty years ago
in me more than fifty years ago can you
tell the story like you're describing
your new book of how UNIX was created ha
if I couldn't remember that far back
well it was some while ago um so I think
the gist of it is that at Bell Labs and
in 1969 there were a group of people who
had just finished working on the multics
project which was itself falling on to
CTS s so we can go back sort of an
infinite regress in time but the CTS s
was a very very very nice time sharing
system was very nice to use I actually
used it as that summer I spent in
Cambridge in 1966 for was the hardware
there right so what's the operating
system what's the hardware there what's
the CTS look like so cts s looked like
kind of like a standard time sharing
system certainly at the time it was the
only time sharing if no let's go back to
the basic ok in the beginning was the
word and the word sign 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 used things like punch cards to
write programs on talk to him 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 on 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 character let me
remember that and then it go back to
doing something else would be going
around and around a group of
who were trying to get something done
giving each a small slice of time and
giving them each the illusion that they
pretty much hit the whole machine to
themselves and hence time sharing that
is sharing the computing time resource
of the computer among a number of people
who are doing it without the individual
people being aware that there's others
in a sense the illusion the feeling is
that you 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 were doing too
much you did have the illusion that you
had the whole machine to yourself and it
was very much better than the punch card
model and so cts s 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 an IBM 7090 for slightly modified
to have twice as much memory as the norm
it had two banks of 32 k words instead
of one so 32 K words yes where's this 36
bit so call it you know about a hundred
and fifty kilobytes times two so by
today's standards that's down in the
noise yeah at the time that was a lot of
memory and memory was expensive so C TSS
was just a wonderful environment to work
on it was done by the people that MIT
led by Fernando Corbett Oh of Cour be
who died just earlier this year and a
bunch of other folks and then so I spent
the summer of 66 working on that had a
great time met a lot of really nice
people and indirectly knew of people at
Bell Labs who were also working on a
follow-on to C TSS that was called
multics so multics was meant to be the
system that would do everything that C
TSS did but do it better for a larger
population that's 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 things are very
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 scheduler according to things
like that so okay so multics
was trying to just do some of the clean
it up a little bit well it was it was
meant to be much more than that so
multix was the multiplexed information
and computing service and it was meant
to be a very large thing we 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 yeah same
idea but 50 odd years earlier
and so what multix offered was a richer
operating system environment 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 is
starting to become now which is
computing is everywhere that you can
just plug in almost no you know and you
never know how the magic works you just
kind of plug in add in your little
computation they need to perform and it
does it it was that the dream I don't
know where that was the dream I wasn't
part of it at that point remember I was
an intern first 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 could you have predicted what
computers are today that you sense Oh
short answer absolutely not 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 snows 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 going to
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 where a
location called Murray Hill is actually
then 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 an hour
north of here and for instance and at
that time it had make up a number three
or four thousand people there many of
whom had PhDs and mostly doing physical
sciences chemistry physics materials
kinds of things but very strong math and
it rapidly growing interest in 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 the permanent play 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
this is 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 is
unbelievable so is it was there
something special about that place oh I
think there was very definitely
something special I mentioned the number
of people's a very large number of
people very highly skilled
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 a TMT which provided
basically the country's phone service
the goal of a TMT 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 in
computing as well is 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 multix in spite of
having an enormous number of 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 so General Electric was
the hardware operation so Bell Labs
realizing this wasn't going anywhere on
a time scale they cared about
pulled out his 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 going
to design a new operating system that
would provide the same kind of
comfortable computing as cts s head but
also the facilities of something like
multics 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 do you
store information on a computer in an
efficient 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 ultimately became Unix so software
productivity was good in those days
the PDP what's the PDP seven so it's a
piece of hardware yeah it's a piece of
part where it was one of our leading
machines made by Digital Equipment
Corporation Dec and it was a mini
computer so called
it had yeah 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 it up a
hundred thousand dollars or something
like that which is not super expensive
in the sious right it was expensive it
was enough that you and I probably
wouldn't be my white 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 Ken went through in three
weeks because you were I mean you're
part of that process you've contributed
a lot to UNIX his early development so
what do you think it takes to do that
first step that first kind of from
designed to a reality on the PDP 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 that 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 Ken wrote an assembler
for
pdp-7 that worked he needed 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
it in assembly pdp-7 assembler that Ken
created these things were assembly
language until probably the call at 1973
or 74 something like that yeah
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 a
software engineering assembly is to work
on a big picture I think it's hard it's
been a long time since I wrote assembly
language it is absolutely true that in
some other language if you make a
mistake nobody tells you there are no
training wheels whatsoever and so stuff
doesn't work now what and there's no the
buggers 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 of
today's picture so 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 gonna die several
leagues removed I know there's levels
this is it's a 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 a wife does
have to leave see like there's this
weird timing that happens that and then
all sudden something beautiful is
created I mean how does it make you feel
that there's a system I was created in
in three weeks or
maybe you can even say on a whim but not
really but of course quickly that is now
you could think of most of the computers
in the world run on a unix-like system
right well how do you ensure like if you
kind of zoom from the alien perspective
if you're just observing earth that all
sudden these computers took over the
world and they started from this little
initial seed of Unix
how does that make you feel it's quite
surprising and and and you asked earlier
but predictions 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 luck I suspect more the latter
and so I look at it and think gee that's
kind of neat I think the real question
is what this can think about that
because he's the guy arguably from whom
it really came tremendous contributions
from Dennis Ritchie and then others
around in that Bell Labs environment but
you know if you had to pick a single
person that would be can see if written
in you book
UNIX a history and a memoir are there
some memorable human stories funny or
profound from that time they just kind
of stand out oh there's a lot of them in
a sense and again it's a question if can
you resurrect them this memory fails but
I think part of it was that Bell Labs at
the time was 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 from the environment and so if you
had an interesting problem you go and
talk to somebody and they might help you
with the solution and and it was a kind
of a fun environment to in which people
did strange things and often tweaking
the bureaucracy in one way or another
the 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 that
they didn't really want to so maybe to
linger on it a little bit you have a
sense of what the philosophy that
characterized
unix's the design not just the initial
but just carry through the years just
being there being around 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 her easier
productive to write program so as men 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 so
the programmers 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 that says that and that from
his standpoint the real goal was to
create a community where people could
work as programmers on a system 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
are of more and more stuff coming out
that was really good for programmers and
you're part of that community of
programmers so what was the like writing
programs on that early unix it was a
blast it really was you know 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
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 and you know 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
and the feedback Luke was then very very
short and tight and so a lot of things
got developed fairly quickly that in
many cases still exists 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 as part of
the reward mechanism and what was the
method of an interaction the
communication we need that feedback loop
I mean this is before the internet
certainly before the internet um it was
mostly physical right there you know
somebody would come into your office and
say something so these places are all
closed but like offices are nearby we'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
oh how big was it probably call it 50
feet by 50 feet make up a number of that
and which had some access to computers
there as well as in offices and people
hung out there and had a coffee machine
and so that there was a 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 Bell
Labs it seems so many the people being
in the vicinity of each other it's sort
of getting that quick feedback working
together there's 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
yeah well how does that make you feel
that that's a 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 we're doing really
interesting work as well Xerox PARC is
perhaps most obvious one Xerox PARC
contributed enormous amount of good
material and Men anything
we take for granted today in the same
way came from Xerox PARC 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's
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
turned out to be open source because of
the various ways that AT&T operated and
sort of they had to it was the focus was
on telephones so well 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
TMT code now there was an enormous
amount of legal jockeying around this
that in the late early to late 80s Early
90s something like that and then not
something that 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 Torvalds
decided he was going to do a unix-like
operating system there was enough
expertise that in the community that
first he had a target he could see what
to do because the kind of the UNIX
system call 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 it's funny that from my
distant perception I felt that UNIX was
open-source without actually knowing it
but what you're really saying it was
just freely licensed so it was freely
licensed it felt open-source in a sense
because universities are not trying to
make money so there it felt open-source
in a sense that you can get access if
you wanted 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 so technically not open
technically belonging day T&T
pragmatically pretty open and so there's
a ripple effect that all the faculty and
the students then I'll grew up and then
they went throughout the world and
permeated in that kind of way so what
kind of features do you think made for a
good operating system if you take the
lessons of Unix you said like you know
make it easy for programmers like that
seems to be an important one 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 minimal 'ti of
mechanisms and maybe a search for
generalizations so that you would find
one mechanism that's served for a lot of
different things rather than having lots
of different special cases I think the
file system and UNIX is a good example
of that file system interface in its
fundamental form is extremely
straightforward and that means that you
can write code very very effectively
from for the file system and then one of
those ideas and 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 9
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 that in
plan 9 a lot of different resources our
file systems they all share that
interface so that would be one example
we're 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 him
to think as hard about it so you said
you're not a very good programmer you're
the most modest human being ok 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 there's a 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 did 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 the people who
might use this program want and I think
that's 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 II 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 or scale properly avoiding
quadratic algorithms when a linear
algorithm should be the right thing that
got a more formal view of it
same thing for data structures but also
it's I think an engineering field as
well then 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 the
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 gonna 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 their 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 of writing a program say a
small and large sort of tinkering with
stuff you just start coding right away
and just kind of evolve iteratively with
a loose notion or do you plan and a
sheet of paper first and then kind of
design and this you know what they teach
you in the kind of software engineering
courses an 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 weighs
more and then 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 on 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 awk scripts because two
or three lines will tell you something
about a piece of data and then when it
gets bigger well and 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 awk
first what is awk so awk is a scripting
language that was done by myself el hijo
on Peter Weinberger we did that
originally in the late 70s it was a
language that was meant to make
really easy to do quick and dirty tasks
like counting things or selecting
interesting information from basically
all text files rearranging it in some
way or summarizing it runs the command
on each line of a file I mean there's uh
it's still exceptionally widely used
today oh absolutely yeah it's so simple
an elegant sort of the way to explore
data turns out you can just write a
script that does something seemingly
trivial on a single line and that giving
you that slice of the data somehow
reveals something fundamental about the
data you know 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 is
actually quite good for a lot of data
processing kinds of tasks and that it's
it's kept going as long as it has
because at this point it's over 40 years
old but 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 something's in something so yeah
I find I probably write more awk than
anything so what 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 it is there
something that stands out from
particular features I think it's mostly
the selection of default behaviors that
you sort of hinted at at a moment ago
what Octus is to read through a set of
files and then within each file it rich
through a 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 um and that's all completely
automatic you don't have to say any
think about it you just write the
pattern in the action and then run the
data by it and and so that paradigm for
programming is very natural and
effective one and I think we captured
that reasonably well and lock and it
does other things for free as well it
splits the data into fields so that on
each line there feels separated by 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 Arcis one or two lines and 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 and the interaction with
Allah perfectly is there other shell
commands that you love over the years
like you really enjoy using don't major
does everything so grep is a kind of
what is it a simpler version of awk I
would say in some some sense yeah right
because what is grep so grep is it
basically searches the input for
particular patterns regular expressions
technically of a certain class and it
has that same paradigm that awk 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 it's a in that
sense it's a much simpler version and
you could write crap in Arcis as a
one-liner and I use grep probably more
than anything else at this point just
because it it's so convenient and
natural why do you think it's such a
powerful tool grab not 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 like the which
you could basically use all the fun
stuff like all can graph and inside of
Windows but Windows naturally sort of in
the best part of the graphical interface
the simplicity
sort of searching through a bunch of
files and just popping up naturally
why don't you think that why do you
think that's unique to the UNIX and
Linux environment I don't know I it's
not strictly unique but it's certainly
focused there and I think some of its
the weight of history that Windows came
from ms-dos ms-dos was a pretty pathetic
operating system although common own and
you know unbounded lis 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 worked
right rather well for people who are not
programmers just want to get something
done whereas teaching something like the
command line to non-programmers turns
out just sometimes be an uphill struggle
and so I think Microsoft probably was
right and what they did now you
mentioned whistle or whatever it's
called that winix I wonder what spinasse
wsl is but I've never actually
pronounced the whistle I like it I got
no idea but there have been things like
that for longest cygwin 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 a something
that's been going on for at least 20
years if not longer and I use that on my
one remaining Windows machine aw
routinely because it it's for if you're
doing something that is batch computing
command sudo 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 cygwin to try whistle yes
I say I've been so excited that I could
use best ivy bash write scripts quickly
in in Windows it's changed my life
okay what's your perfect programming
setup what computer what operating
system want keyboard what editor yeah
perfect is too strong a word is way to
struggle read of what
by default I have a at this point a
13-inch MacBook Air which I used because
it's kind of a reasonable balance of the
various things I need I can carry it
around it's got enough computing
horsepower screens big enough to
keyboards okay and so I basically do
most of my computing on that um 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 none
tends not to be used as much editor I
use mostly Sam which is an editor that
Rob Pike wrote long ago at Bell Labs his
did that sorry to interrupt it does that
precede VI posts it post dates both VI
and Emacs it is derived from Rob's
experience with Edie and VI on D that's
the original UNIX editor o dated
probably before you were born so what's
actually what's the history of editors
can you can you briefly this is your fan
I used Emacs I'm sorry to say so I'm
sorry to come out with that but what's
what's the kind of interplay there yeah
so in ancient ancient times like call it
the first time sharing systems going
back to what we're talking about there
were editors there was an editor on C
TSS that I don't even remember what it
was called al it might have been edit
where you could type text program text
and it would do something or other
document text if it's saved then I'd
save it you could edit it you know 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 no CRT type displays let alone LEDs
and so then when UNIX came along Ken
took QED and stripped way way way way
down
and that became an editor that he called
needy it was very simple but it was a
line oriented editor and so you you
could load a file and then you could
talk about the lines one through the
last line and you could you know 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 they can work
on a parts of a file essentially yeah
you could work on any part of it the
whole thing whatever but it was entirely
command line based and it was entirely
on paper okay paper and that meant that
you've 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 changed cause okay
yeah
so when thing when CRT displays came
along yeah then you could start to use
cursor control and you could sort of
move where you where on the screen in
without reprinting printing and one of
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
joy and so that dates from probably the
late 70s as a guess and it took at full
advantage of the cursor controls I
suspected Emacs was roughly at the same
time but I don't know I've never
internalized Emacs so so I use at this
point I stopped using IDI always can I
use VI sometimes and I use Sam when I
can and Sam is available on most systems
it was 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'll get home tonight I'll try it
that's cool it's a it's a sound sounds
fasting all though my love is with Lisp
and Emacs have went into that hippie
world of
I think it's likes what religion where
you brought up with yes sir that's right
most of the actual programming I do is C
C++ and Python but my weird sort of yeah
my religious upbringing is unless so can
you take on the impossible 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 zeros 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
mnemonics like add a DD into whatever
the bit pattern was it corresponding to
an add instruction and they'd 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 they were
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 in the
paper just a couple days ago Tony
Burkert died he did this thing in
Manchester called the called auto code a
language for China knew only by name but
it sounds like it was a flavor of
assembly language sort of a little
higher in some ways um and a replaced on
language that Alan Turing wrote which
you put in zeros and ones but you put in
an in backwards order because that was a
Hardware worked very tense right yeah
yeah that's right backwards so assembly
languages learn let's call at the early
1950s and so every different flavor of
computer has its own assembly language
so the EDSAC head hits in a manchester
head it and the IBM whatever 70 90 or
704 or whatever had hits and so on so
everybody had their own assembly like
when assembly languages have a
few commands addition subtraction then
branching of some kind if then that 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 jeez
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
realize 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 we're I
guess arguably three or four at that
time period there was Fortran which came
from IBM which was formula translation
and to make it easy to do scientific and
engineering computation is not that
formula translation that's what I stood
for yeah I where's COBOL which is the
common business oriented language that
Grace Hopper and others worked on which
was named business kinds of tasks there
was a well 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 Fortran for
formula translation engineering
computations let's say COBOL for
business that kind of thing still used
today
Fortran probably oh yeah COBOL too but
the deal was that once you moved up that
level then you let's call it Fortran 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 is 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 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 the ability to write
code
so it puts the power of programming to
the hands of people like you yeah
anybody who wants to who under 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 what a system programming language
learning programs that programming
languages that would take on the kinds
of things that would necessary to write
so-called system programs things like
text editors or assemblers or compilers
or operating systems themselves those
kinds of things
and fortunately feature-rich they have
to be able to do a lot of stuff a lot of
memory management access processes and
all that kind of stuff they a little
processing it's a different flavor 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 and underway there
and more ways to structure and organize
data and so the system programming
languages there was a lot of effort in
that and call it the late 60s early 70s
C is 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 it's
and then it took off from there I mean
there's also a parallel slightly
parallel track with a little bit of
functional stuff with Lisp and so on but
I guess from that point is just an
explosion of languages it was a Java
story there's the JavaScript there's all
the stuff that the cool kids these days
are doing with rust and all that they
don't so what's to use you're you wrote
a book C programming language what and C
is 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 see why did it survive
what did it have such a long-lasting
impact I think it found a sweet spot
that in of expressiveness so you can
rewrite things in a pretty natural way
and efficiency which was particularly
important when computers were not nearly
as powerful as they are today
again put yourself back 50 years almost
in terms of what computers could do
that's you know roughly four or five
generations decades of Moore's law 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 in
Resume
Read
file updated 2026-02-13 13:23:25 UTC
Categories
Manage