Key Moments

Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming | Lex Fridman Podcast #109

Lex FridmanLex Fridman
Science & Technology5 min read104 min video
Jul 18, 2020|754,161 views|14,527|755
Save to Pod
TL;DR

Brian Kernighan on UNIX, C, AWK, AMPL, Go, and the evolution of computing.

Key Insights

1

UNIX emerged from the failure of MULTICS, born out of a desire for a more accessible and efficient computing environment.

2

The C programming language, co-authored by Kernighan, found a sweet spot between expressiveness and efficiency, becoming foundational for UNIX and beyond.

3

AWK, a text-processing language co-created by Kernighan, remains remarkably useful for quick data exploration due to its simple, natural programming paradigm.

4

Bell Labs was a unique, collaborative environment that fostered innovation, with UNIX and C emerging from this fertile ground.

5

Programming is a blend of art and science, requiring creativity to define problems and rigor to solve them efficiently within given constraints.

6

Modern programming heavily relies on libraries, a shift from the earlier days of building everything from scratch, with implications for complexity and security.

THE BIRTH OF UNIX AND THE RISE OF TIME-SHARING

The conversation begins with the genesis of UNIX, tracing its roots back to the MULTICS project and the earlier era of time-sharing systems. Kernighan explains that time-sharing, which gave users the illusion of having dedicated access to a computer via terminals, was a significant improvement over the cumbersome punch-card methods. MULTICS, intended as a more ambitious information utility, ultimately proved too complex and costly. Bell Labs' withdrawal from MULTICS led to the creation of UNIX by Ken Thompson and Dennis Ritchie, aiming to provide a more manageable yet powerful computing environment.

THE ENDURING LEGACY OF THE C PROGRAMMING LANGUAGE

Kernighan, co-author of 'The C Programming Language,' discusses C's pivotal role. He highlights that C found an optimal balance between being expressive enough for natural programming and efficient enough for the hardware capabilities of its era. This efficiency was crucial given the limited resources of early computers. C's tight integration with the UNIX operating system, which was itself largely written in C, made both highly portable and adaptable, contributing to their widespread adoption and lasting impact.

AWK: A TIMELESS TOOL FOR DATA EXPLORATION

Kernighan describes AWK, a text-processing scripting language he co-created, as a tool designed for quick, 'dirty' tasks like counting, selecting, and rearranging data from text files. Its elegance lies in its simple, natural programming model, where scripts operate line by line on input files based on patterns and actions. This paradigm, combined with automatic field splitting and built-in variables, allows for concise, powerful data manipulation, making AWK still incredibly useful for data exploration over 40 years after its creation.

BELL LABS: A UNIQUE ENVIRONMENT FOR INNOVATION

Kernighan paints a picture of Bell Labs during its golden age as a unique, highly collaborative environment. It attracted top scientific and mathematical talent, fostering an open and free atmosphere where researchers could easily interact and share ideas. This environment was crucial for the development of innovations like UNIX and C, as programmers could quickly prototype, experiment, and receive immediate feedback from colleagues, creating a virtuous cycle of development and refinement.

THE ART AND SCIENCE OF PROGRAMMING

Discussing his own process and the nature of programming, Kernighan views it as a blend of art and science. The 'art' involves understanding the problem, envisioning a good program, and considering user needs. The 'science' and 'engineering' aspects involve choosing appropriate algorithms, data structures, and managing constraints like time, resources, and future maintenance. He admits to preferring an incremental, tinkerer's approach over rigid, upfront planning for his own coding.

THE EVOLUTION OF PROGRAMMING LANGUAGES AND TOOLS

Kernighan provides a historical overview of programming languages, from early assembly languages to higher-level languages like FORTRAN and COBOL, and then to system programming languages like C. He touches upon the rise of object-oriented programming and the explosion of modern languages. He notes the significant shift towards using extensive libraries in languages like Python and JavaScript, a contrast to the earlier era of building much more from scratch, which introduces both power and new complexities regarding dependencies and security.

AMPL: MODELING OPTIMIZATION PROBLEMS

Kernighan discusses AMPL, an Algebraic Modeling Language for optimization problems. He clarifies that while he contributed, the core work was done by his partners, Bob Fourer and Dave Gay. AMPL's strength lies in separating the abstract mathematical model from the data and the solver, allowing clear expression of complex optimization problems that can then be fed to specialized solvers. This separation makes models human-readable and adaptable to different datasets and solvers.

THE CHALLENGES AND PROMISE OF ARTIFICIAL INTELLIGENCE

Reflecting on his early research in AI, Kernighan contrasts the initial optimism of the 1960s with the long roads to achieving breakthroughs like advanced game playing and natural language processing. He expresses interest in current machine learning and neural networks but also notes significant concerns about bias in training data and the potential for amplifying societal inequalities. He remains uncertain about the path to human-level AI, emphasizing the complexity and the need for careful consideration.

COMPUTING'S IMPACT ON SOCIETY AND THE FUTURE

Kernighan acknowledges the profound and often mixed impact of computing on society. While it enables unprecedented global communication and potential for progress, it also introduces challenges like privacy concerns, misinformation, and increased societal divisions ('us vs. them'). He suggests that while technologies often prove beneficial in the long run, their short-term effects can be problematic, requiring careful management and critical engagement with their use and implications.

THE FUTURE OF MOORE'S LAW AND PROGRAMMING ABSTRACTION

Regarding Moore's Law, Kernighan believes that exponential growth cannot continue indefinitely but notes that innovation may shift, such as increasing the number of processors rather than their speed. He predicts that future programming will involve more automation, with programs writing programs and a greater reliance on declarative approaches. He anticipates increased levels of abstraction, potentially leading to systems that can infer user intent and execute tasks with less detailed procedural instruction.

Common Questions

UNIX was born out of the discontent with the Multics project at Bell Labs in 1969. A group of engineers, including Ken Thompson, who had a taste for comfortable computing environments but lacked one, started designing a new operating system. Ken Thompson famously wrote the initial version of UNIX in assembly language on a little-used PDP-7 machine in just three weeks.

Topics

Mentioned in this video

People
Snoop Dogg

A celebrity mentioned as using Raycon earbuds.

Cardi B

A celebrity mentioned as using Raycon earbuds.

Richard Stallman

Mentioned in the context of starting the open source movement in the late 1980s.

Grace Hopper

Worked on the COBOL programming language.

Alan Donovan

The lead co-author of Brian Kernighan's book on the Go programming language, referred to as the Go expert.

Tony Hoare

Cooperating Communicating Sequential Processes that Tony Hoare set forth

Richard Feynman

A renowned physicist mentioned hypothetically listening to podcasts with Raycon earbuds.

Linus Torvalds

Creator of Linux, who built a UNIX-like operating system in 1991, capitalizing on the availability of UNIX expertise.

Al Aho

Co-creator of the Awk scripting language alongside Brian Kernighan and Peter Weinberger.

Sam

A text editor written by Rob Pike at Bell Labs, preferred by Brian Kernighan when available, and can be downloaded from Plan 9 distributions.

Bob Fourer

A professor of industrial engineering and management science at Northwestern, and one of Brian Kernighan's partners in developing AMPL.

Dave Gay

A numerical analyst and optimization expert at Bell Labs, and another partner in the development of AMPL.

Robert Frost

An American poet, referred to for his poem about choosing two paths.

John Hopcroft

A Turing Award winner and a colleague Brian Kernighan briefly worked with as a grad student, from whom he realized theoretical computer science was not his calling.

Dennis Ritchie

The creator of the C programming language and co-author of 'The C Programming Language' book with Brian Kernighan, also a key contributor to UNIX.

Alan Turing

Created an early language using zeros and ones in backwards order, and discussed his paper on machine intelligence.

Melissa Etheridge

A celebrity mentioned as using Raycon earbuds.

Fernando Corbató

Led the team at MIT that created CTSS, highlighting his significant contribution to early time-sharing systems.

Arthur C. Clarke

Science fiction author whose remark about distinguishing between possible and impossible scenarios is paraphrased by Kernighan.

Brian Kernighan

Professor of Computer Science at Princeton University, co-author of C programming language, co-creator of Awk and AMPL, and author of several books on programming.

Ken Thompson

A key figure in the early UNIX days and one of the creators of UNIX, who famously wrote the initial operating system in three weeks on a PDP-7.

Bill Joy

A notable contributor to the Berkeley version of UNIX and the creator of the VI editor.

Peter Weinberger

Co-creator of the Awk scripting language alongside Brian Kernighan and Al Aho.

Rob Pike

Author of the Sam text editor and one of the three creators of the Go programming language.

Tony Brooker

Credited with creating 'AutoCode' for the Manchester computer, an early programming language.

Robert Griesemer

One of the three creators of the Go programming language, influenced by the European computer science tradition (ETH Zurich).

Jeff Dean

Lex Fridman mentions an anecdote where Jeff Dean made a witty remark about P equaling NP.

Shen Lin

Worked with Brian Kernighan at Bell Labs on graph partitioning and heuristics for the Traveling Salesman Problem.

Donald Knuth

A prominent computer scientist known for algorithm design, mentioned as an alternate path Brian Kernighan could have pursued.

Jim Keller

Mentioned by Lex Fridman as someone who believes Moore's Law will continue indefinitely due to potential for transistor size reduction.

Stephen Cook

Showed that there were classes of problems (like graph partitioning) that appeared to be really hard, related to NP-completeness.

Software & Apps
Plan 9 from Bell Labs

An operating system that further generalized UNIX ideas, treating many resources as file systems.

grep

A command-line tool for searching text using regular expressions, described as a simpler version of Awk, used extensively by Brian Kernighan.

QED

An editor written by Ken Thompson, later stripped down to become Ed for UNIX.

BASIC

An early programming language mentioned chronologically after Fortran, COBOL, and ALGOL.

JavaScript

A programming language noted for its initial irregular and ugly perception, but which has evolved with fantastic compilation technology and is now viable for backends and frontends.

Haskell

A functional programming language that took Brian Kernighan several weeks to use for a trivial program, and it ran slowly.

Berkeley Software Distribution

A version of UNIX that started with licensed AT&T code and gradually became free of proprietary code through contributions from people like Bill Joy.

MS-DOS

An early operating system that Windows evolved from, described as 'pathetic' but widely used.

Windows Subsystem for Linux

A Windows feature that allows users to run Linux command-line tools like Bash, Awk, and Grep directly on Windows.

Cygwin

A collection of UNIX and Linux tools that run perfectly on Windows, used routinely by Brian Kernighan on his Windows machine.

Vi

A cursor-based text editor created by Bill Joy in the late 1970s, which Brian Kernighan still uses sometimes.

Ed

The original UNIX line-oriented editor, developed by Ken Thompson, used on paper terminals.

C++

An object-oriented programming language that emerged from the C tradition to manage larger codebases and prevent bad programming practices.

Rust

A modern programming language that Brian Kernighan would like to learn but found challenging due to rapidly changing documentation and an unfamiliar memory management model.

Ruby

A programming language mentioned as having its own community, contributing to the separation of programming communities.

LaTeX

A document preparation system, mentioned in comparison to 'troff' for typesetting books.

Go

A modern programming language, of which Brian Kernighan co-authored a book, noted for its powerful concurrency model using 'goroutines'.

AWK

A text processing language co-created by Brian Kernighan, Al Aho, and Peter Weinberger, widely used in Linux environments for quick data filtering and manipulation.

AMPL

An algebraic modeling language co-designed by Brian Kernighan for large-scale optimization problems, praised for its elegance, abstraction, and separation of model from data.

CTSS

The Compatible Time-Sharing System, an early and influential time-sharing system that preceded Multics, known for being a nice environment to work on.

NPM

The package manager for JavaScript, criticized for having less discipline and control, leading to security issues with many unknown packages.

Unix

An operating system discussed as having been developed over 50 years ago, originating from efforts at Bell Labs and becoming a foundational system for modern computing due to its programmer-centric design and efficiency.

Linux

An operating system used by people like Lex Fridman, where Awk is a common tool. Linux is described as a 'UNIX-like' system that became widely adopted.

Multics

A multiplexed information and computing service project that preceded UNIX, aiming to be a large-scale computing utility but ultimately failed to meet its goals due to cost and delays.

Emacs

A text editor mentioned as being roughly contemporary with Vi, but Brian Kernighan has never internalized its use.

COBOL

Common Business-Oriented Language, developed by Grace Hopper, for business tasks, still used today.

ALGOL

An early programming language meant to describe algorithmic computations.

Java

A programming language mentioned as part of the explosion of languages after C++.

Lisp

A functional programming language, representing the 'hippie world' to Lex Fridman, and mentioned as an early language exploring functional concepts like recursion.

Joe Rogan Experience

A podcast mentioned hypothetically being listened to by Richard Feynman using Raycon earbuds.

Windows

Microsoft's graphical operating system, which evolved from MS-DOS, focusing on point-and-click interaction rather than command-line tools like Grep and Awk.

Scala

A programming language, described as a flavor of Java, which Brian Kernighan found equally trivial to use for a small task.

Fortran 90

A version of Fortran that Brian Kernighan found painful to use for a small program, though it worked.

Python

A programming language used by Brian Kernighan for exploratory data analysis due to its scalability for a few hundred lines of code, also mentioned as having package management issues with 'pip install'.

GAMS

A modeling language that existed before AMPL, but was considered 'clunky' and very much like Fortran.

Troff

A text formatter developed at Bell Labs in the early 1970s, used for typesetting AMPL books, predating TeX.

More from Lex Fridman

View all 505 summaries

Found this useful? Build your knowledge library

Get AI-powered summaries of any YouTube video, podcast, or article in seconds. Save them to your personal pods and access them anytime.

Try Summify free