第 109 期·中文精讀

布萊恩·克尼漢:UNIX、C、AWK、AMPL 與 Go 程式設計

Brian Kernighan: UNIX, C, AWK, AMPL, and Go Programming

親歷者講述 UNIX 與 C 語言的誕生,以及 AWK、AMPL 和 Go 背後的設計思想與工程文化。

官方音訊00:00 / --:--
中文精讀由 AI 基於原始訪談改寫,非官方翻譯,可能存在偏差或錯誤;表述以原音訊與官方文稿為準。說明

1969 年,Ken Thompson 的妻子帶著一歲的兒子去加州探親,為期三週。他獨自留在新澤西,用這三週寫下了一個作業系統。

五十年後,世界上絕大多數計算機執行的都是它的後代。

這個系統叫 Unix。

布萊恩·克尼漢(Brian Kernighan)就在現場。他在貝爾實驗室待了很多年,和 Ken Thompson、Dennis Ritchie 是同事,與 Ritchie 合著了《C 程式設計語言》,還共同創造了文字處理語言 AWK 和代數建模語言 AMPL。Lex Fridman 在節目開頭說他是"我在這個播客裡聊過的最謙遜、最友善的人之一"。而克尼漢整場對話反覆說的一句話是:我不行,那主要是別人的功勞。

這種謙遜是真的。可他參與創造的東西,構成了今天幾乎所有軟體開發的地基。他自己在節目裡開玩笑說,AWK 現在還有數百萬人在用,所以"你的愚蠢錯誤也擺在他們面前讓人看"。這句話其實才是這篇文章的入口:一個站在技術史關鍵節點上的人,怎麼看待自己參與締造的世界。

三週,一個作業系統

要理解 Unix 為什麼會出現,得先回到沒有它的年代。

1950 年代到 1960 年代初,大多數計算在物理上巨大的機器上完成,體積大,按今天的標準卻一點都不快,被安放在專門的機房裡。你寫程式用打孔卡,把一疊卡片寫好,交給櫃檯,櫃檯轉給操作員,過一陣子回來的答覆往往是"你這裡寫錯了",然後你回去改,重來。整個迴圈非常慢。

分時系統的想法是:還是那臺機器,但用類似電動打字機的終端接上去,讓每個人輪流用一小片時間。你敲一個鍵,作業系統醒來,記下這個字元,然後回去處理別人的事。它繞著所有人轉圈,給每個人一小塊時間,製造出一種"這臺機器基本是我一個人的"錯覺。

這種錯覺是好東西。它比打孔卡模式好太多,而且它催生了整個互動式計算的傳統。

第一個比較像樣的分時系統叫 CTSS,相容分時系統。1966 年夏天,克尼漢作為實習生用過它,主持者是 Fernando Corbató,一位剛在這年去世的圖靈獎得主。CTSS 跑在一臺 IBM 7094 上,記憶體被擴到常規的兩倍:兩組 32K 字,每字 36 位,換算下來一次大概 150KB 乘二。今天這點記憶體在噪聲裡都找不到,當年卻是一筆鉅款。

CTSS 之後是 Multics。名字是 Multiplexed Information and Computing Service,多重資訊與計算服務。它的野心是做一個"資訊公用事業",可以讓計算像牆上的插座一樣即插即用。你聽這個概念會覺得很熟,因為這基本就是今天雲端計算的描述,只是早了五十年。

Multics 由 MIT、貝爾實驗室和通用電氣三家一起做,通用電氣提供硬體。麻煩在於它太貴,承諾的東西交付得太晚。1969 年初,貝爾實驗室決定退出。

這一退,留下了一批已經嘗過好環境滋味、現在卻無環境可用的人。他們開始做紙面設計,想一個新的作業系統該長什麼樣。同時 Ken Thompson 找到一臺使用不多的 PDP-7,開始拿它做檔案系統的實驗,琢磨資訊該怎麼高效地存到計算機裡。然後他妻子去了加州,他坐下來,把它寫成了一套作業系統。

克尼漢對這段有個明確的糾正。很多人以為他也是 Unix 的作者之一,他本人說:"我和它沒有任何關係,我從沒寫過作業系統程式碼。"他說得很清楚,真正的作者是 Ken Thompson,加上 Dennis Ritchie 和周圍一批人的巨大貢獻。

"Ken Thompson 是我見過的程式設計師裡的一種奇異點。沒有對你不敬的意思,也沒有對我自己,但他現在已經在好幾個量級之外了。"(Brian Kernighan)

三週寫一個作業系統,聽起來像神話。這裡面確實有運氣成分,有那種"某個人在某個時間點恰好出現"的時機問題。但克尼漢也提醒,那時候的系統按今天的標準並不大。早期的 Unix 就是一段程式碼,讓你能執行程序,能存檔案,能載入可執行程式碼到記憶體,交給它控制權,跑完再收回來。再加上一個彙編器、一個文字編輯器、一套檔案系統,核心就齊了。這些在 1973 到 1974 年之前,全是用 PDP-7 組合語言寫的。

用匯編寫複雜系統難到什麼程度?克尼漢說,在這種語言裡你犯了錯沒人會告訴你,沒有輔助輪。你只能靠某種看全域性的能力,把東西一點點拼起來。他自己已經很久沒寫過彙編了,但那種"沒有訓練輪"的感覺他記得很清楚。

貝爾實驗室:傳奇是怎麼被養出來的

貝爾實驗室當時在新澤西有好幾處,主址在 Murray Hill,跨在兩個小鎮的邊界上,從紐約市往西大約十五到二十英里。那裡有三四千人,很多是博士,主要做物理科學,化學、物理、材料,數學也很強,同時對計算的興趣越來越大,因為人們發現可以用計算機去建模、去替代一部分實驗室工作。

它隸屬於 AT&T。AT&T 提供的是全美的電話服務,貝爾實驗室的目標就是讓這個服務不斷變好。這個目標聽起來平淡,但它決定了一切:為了改進電話服務,你需要做電晶體,需要做光纖,需要做微波系統,需要研究材料、器件和數學。指標看起來是服務,實際落到研究上,就是有大量基礎問題可以啃。

克尼漢強調那個環境非常開放、非常合作,友好到有點不像大公司。你有問題就去找人,對方可能就幫你解決。人們會幹一些奇怪的事,時不時地戳一戳官僚體系,帶點反叛的意味。

他特別提到物理上的接近:貝爾實驗室本質上是一棟巨大的樓,做相關工作的人擠在兩三個樓區裡,還有一個五十英尺乘五十英尺左右的公共空間,放著咖啡機,人們在那裡閒逛。反饋迴圈非常短。你早上有個想法,晚上或者第二天就有一個能跑的東西,別人會來試,會說"這很棒,但你這裡搞砸了"。

這是不是獨一無二?克尼漢立刻用了"倖存者偏差"這個詞來打自己。他說,如果這事沒發生在貝爾實驗室,別的地方也在做同樣有意思的工作。施樂帕克研究中心(Xerox PARC)就是最明顯的例子,貢獻了多得驚人的東西,很多我們今天習以為常的技術都出自那裡。只不過帕克的母公司可能沒那麼幸運,沒有把這些成果好好變現。

回到程式設計本身。克尼漢說,早年程式設計的樂趣之一是有大量的低垂果實,前人沒做過,環境又是新的,工具好用,系統響應快,同事極強。他把這種體驗總結成一件事:程式設計本身是解謎,是好玩,但真正讓好玩變得更好的,是你做的東西有人用。哪怕他們在抱怨它壞了,他們用了,這件事本身就是獎勵。

Unix 的設計哲學:為程式設計師服務

Unix 的根本目標,按克尼漢的說法,是提供一個讓人容易寫程式、寫程式高產的環境。它的定位就是為程式設計師服務的環境,別的用途都是順帶。

這一點值得細讀。它被大量用於文書處理,但它不是作為文書處理系統設計的;被大量用於實驗室控制,但它不是為此設計的;被大量用作大型系統的前端,也不是為此設計的。它就是讓寫程式變得容易。相應地,寫出來的程式也常常是給別的程式設計師用的,於是形成了一個正迴圈:環境越好寫程式,就有人寫越多有用的程式,越多有用的程式又讓環境更有價值。

Dennis Ritchie 在書末有個觀察,說從他的角度看,真正的目標其實是創造一個社群,一群人可以在這個系統上作為程式設計師一起工作。這個說法比任何技術描述都更貼近 Unix 的本質。

Unix 的效率和健壯性從哪裡來?克尼漢給的理由很樸素:它從極其簡陋的硬體上開始,處理器速度和記憶體都非常有限,這逼著你不能亂來。沒有資源去堆複雜的東西,於是你被迫去找一個機制通吃許多場景,而不是寫一堆特殊分支。

檔案系統是最好的例子。Unix 的檔案介面極其直接,這讓圍繞它寫程式碼非常高效。然後有人發現,這個介面不只能管磁碟檔案,還能管裝置:對裝置讀寫和對檔案讀寫是一回事。

這個泛化思路後來被推得更遠。Plan 9 作業系統在 1980 年代末出現,嘗試把更多資源都塞進同一個介面,程序、網路、各種檔案系統,全部共享那套統一的抽象。每種資源用同一把鑰匙去開,用的人就不用每次都重新想一遍。

這裡藏著一條可以帶走的規律:找到正確的模型,能讓很多事同時變簡單。省下來的認知成本,會轉化成人人都能多做一些有用的事。

一個"開源"的誤會

Lex 問到一個很常見的印象:Unix 後來成了開源系統,因為 AT&T 受各種約束,沒法自己做計算機生意。

克尼漢直接糾正了這個說法。Unix 從來不是開源的,它是明確的專有許可(proprietary)。只是它以原始碼形式,長期免費授權給大學。正是這一點,讓一代代學生和老師看著 Unix 長大,也讓社群裡積累起足夠的專業能力,人們才有可能各自分頭去搭一個"長得像 Unix"的東西。

伯克利版的 Unix 從這個許可程式碼起步,逐漸加入自己的貢獻,尤其來自 Bill Joy 等人的程式碼。加得足夠多之後,它最終能完全擺脫 AT&T 的程式碼。1980 年代末到 1990 年代初,圍繞這件事打了大量法律官司。

開源運動這個說法,大致可以從 Richard Stallman 在 1980 年代末的想法算起。到 1991 年 Linus Torvalds 決定寫一個類 Unix 作業系統時,社群裡已經有足夠多的知識存量。他能看見目標,因為 Unix 的系統呼叫介面、工具集早就在那裡擺著。於是他搭出的是一個到今天說起"Unix",你腦子裡其實想的是 Linux 的東西。

所以那句"技術上不開放,技術上屬於 AT&T,但在實踐中相當開放",是對這件事最準確的概括。

AWK 與 grep:一行程式碼的威力

AWK 是克尼漢和 Al Aho、Peter Weinberger 在 1970 年代末做的,名字來自三個人姓氏的首字母。它的定位是讓"又快又髒"的任務變得容易:數個數、從文字里挑出有意思的資訊、換個方式重排、總結一下、對每一行跑一條命令。

它到今天仍然被廣泛使用,已經四十多年了。克尼漢說,他們當初沒意識到,這個模型其實對很多資料處理任務都很好用,所以它能活這麼久。他半開玩笑地給了個建議:如果按"投入產出比"來算,學 AWK 大概是學一門程式語言裡價效比最高的。它撐不起大專案,但在那些"我就想看看這裡面所有的某某東西"的小事上,表現相當好。

AWK 之所以順手,很大程度上在於它的預設行為設計得好。它自動逐檔案、逐行讀,每一行上你用一組模式和動作來寫程式:如果某個模式匹配,就執行對應的動作。相當於一個四層巢狀迴圈,全部自動完成,你只要寫模式和動作。它還自動把行切成欄位,自動收集資訊,比如這是第幾行、這行有幾個欄位。

結果是,在別的語言裡要五到二十行的東西,在 AWK 裡一兩行就夠。因為只有一兩行,你可以直接在命令列裡做,不用另開一個環境。

grep 更簡單。它搜輸入裡符合某個正規表示式的行,模式匹配就列印。它和 AWK 是同一種正規化,只是模式只有一個、動作也固定成"列印"。克尼漢說自己現在可能用 grep 比用任何別的東西都多,因為太方便、太自然。

為什麼 Windows 一直沒有原生的 grep?克尼漢的猜測是歷史包袱加設計取向。MS-DOS 是個相當糟糕的作業系統,1990 年代某個時候 Windows 變成圖形系統,微軟把能量都投在這個圖形介面上。那是一種面向非程式設計師的計算模型:點、點、點,試選單。對只想把事做完的人,這個模型其實挺好用,反而是把命令列教給非程式設計師常常是一場艱難的 uphill battle。

"從微軟的角度,他們做的大概是對的。"克尼漢說。長期以來的替代方案是 Cygwin 這類東西,把 Unix 和 Linux 上你喜歡的工具全部搬過去,讓它們在 Windows 上正常工作,這套東西已經存在至少二十年。今天還有 WSL,能讓你在 Windows 裡寫 Bash 指令碼。Lex 說自己用過之後"生活都變了"。

編輯器考古:從紙張到 vi

克尼漢平時用什麼編輯器?Sam,Rob Pike 很久以前在貝爾實驗室寫的。它的年代晚於 vi 和 Emacs,源頭可以追溯到最初的 Unix 編輯器 ed。

這段歷史挺有意思,因為它解釋了今天的編輯器為什麼長成這樣。最早的分時系統上有編輯器,完全基於命令。那時候沒有滑鼠,甚至沒有游標,因為終端是把字打在紙上的。Ken Thompson 寫過 QED,功能非常強。Unix 出現後,他把 QED 大幅削減,變成了 ed:一個行編輯器。你可以載入檔案,然後按行操作,列印某幾行,加文字、刪文字、改文字,或者用替換命令改行內的內容。它的介面完全基於命令列,輸出打在真紙上。你改一行,就得把那一行重新列印出來,用掉另一行紙,才能看到改成了什麼。

CRT 顯示器出現以後,才有可能用游標控制,才能在螢幕上移動位置而不用重新列印一切。那個年代出現了好幾個編輯器,克尼漢最熟悉、至今偶爾還在用的是 Bill Joy 寫的 vi,大概出自 1970 年代末,充分利用了游標控制。Emacs 大約同時,但克尼漢說自己從來沒把 Emacs 內化過。

所以他現在的主力是 Sam,有時用 vi。Sam 在大多數系統上都能弄到,通常要從 Plan 9 發行版裡自己下載。

從彙編到 JavaScript:語言的上升史

克尼漢給的程式語言簡史,從打孔卡和麵板開關開始。最早人們用零和一對機器程式設計,後來有了彙編器,把 add 這樣的助記符翻譯成對應的位模式,順便處理"這個東西在記憶體哪裡"的瑣碎工作。

他引用了一個剛過世的例子:Tony Brooker 在曼徹斯特做的 Auto code。它的前身是 Alan Turing 寫的一套語言,你得把指令用零和一寫進去,而且要倒著寫,因為硬體就那麼工作的。

彙編時代的特點是每臺機器一套組合語言,IBM 有它的,曼徹斯特有它的,各不相同。彙編指令和機器的指令集基本一一對應。你必須非常瞭解這臺機器才能寫程式,而且換一臺機器就得從頭開始。

1950 年代末,人們意識到可以把這套遊戲再升一級,造出更接近人類思考方式的語言。那幾年出現了 FORTRAN,來自 IBM,是 Formula Translation,讓科學和工程計算變容易;出現了 COBOL,Common Business Oriented Language,Grace Hopper 等人參與,面向商業任務;出現了 ALGOL,主要用來描述演算法;Basic 稍微晚一點。

這次升維帶來兩件事。第一,程式只寫一次。不同的編譯器可以為不同硬體編譯,程式不再綁死在一種機器上。第二,寫程式碼這件事被民主化了。一個物理學家或工程師,自己就能把程式寫出來,不必去請專業程式設計師。寫出來的質量可能不如專業程式設計師的,但已經夠用。

1970 年代出現系統程式語言,C 是唯一的倖存者。這類語言要能幹系統程式的事,比如文字編輯器、彙編器、編譯器,甚至作業系統本身,所以它得能管記憶體、能訪問程序,和機器打交道的程度更高,但方式更可控。之後是物件導向,C 寫到一定規模就撐不住了,太多碎片沒法追蹤,C++ 從那條傳統裡長出來。再然後就是語言的爆炸,Java、JavaScript,一路到今天。

C 的甜蜜點

為什麼 C 能活下來,影響這麼深?克尼漢的說法是它卡在了一個甜蜜點上:表達能力足夠讓你自然地重寫東西,同時效率也夠高。在高效率尤其重要的年代,這兩點很關鍵。把時間倒回五十年前,那就是四五代摩爾定律之前,機器的能力差得遠。

還有一個因素是環境。C 和 Unix 綁在一起,寫出來的程式可以在所有跑 Unix 的機器上用,而所有這些機器又都是用 C 寫的。作業系統本身可移植,工具也可移植,它們互相餵養,形成正迴圈。

《C 程式設計語言》這本書 1977 年開始寫。當時的時機很好:Unix 正在擴散,從幾十個系統漲到幾百個,C 也在和 Unix 無關的機器上出現。市場上沒有別的 C 書,貝爾實驗室是唯一權威來源。Dennis Ritchie 本人就是權威,因為他設計了這門語言,還寫過一份極其出色的參考手冊。克尼漢說他"擰著 Dennis 的胳膊",直到他同意一起寫書。

書裡最有名的遺產大概是 Hello World。克尼漢對"好例子"的看法很具體:一個好的例子會告訴你如何做一件事,而且它代表的東西,你未必想原樣照做,但你多半想做同一類的事。他花了很多時間找那種能連成一串、能告訴讀者"你需要知道什麼、以及什麼時候會需要"的例子。

他對很多程式設計書的抱怨是:不給現實的、你可能會真的想做的例子,只給純語法。"這裡怎麼把三個數加起來,得了吧,這個我自己能想出來。告訴我這三個數怎麼進到計算機裡,做完有用的事以後,怎麼又整整齊齊地輸出回來。"

這句話背後是一種很樸素的教學觀:人是從能用的東西里學的,不是從語法清單裡學的。

Go:為 21 世紀準備的 C

Go 有兩個源頭。一半是貝爾實驗室的傳統,三位創造者裡的 Ken Thompson 和 Rob Pike 都是那裡的人。另一半來自歐洲學派,經由 Robert Griesemer 傳過來,他算是第二代下傳的學生。這個組合挺有意思。

在克尼漢看來,Go 抓住了 C 裡好的那部分:表面上看非常像 C,有人乾脆把它叫做"21 世紀的 C"。同時它又引入了不錯的資料結構能力。他自己不是 Go 專家,雖然合著了那本 Go 的書,但他說那本書 90% 的工作是另一位作者、真正的 Go 專家 Alan Donovan 做的。

他認為 Go 特別有用的地方是併發模型。它基於 Tony Hoare 四十多年前提出的"通訊順序程序"(CSP)。goroutine 在他看來是描述平行計算非常自然的方式,寫起來容易,通常能正常工作,效率也不錯。

順帶問一句,早期 Unix 的人有沒有預見到執行緒和平行計算?克尼漢猜沒有。也許有人看到了,但很長時間裡,這不是一件你必須去處理的事。處理器越來越快,然後因為功耗和散熱這類問題,不再變快,於是轉向往一顆晶片上放更多處理器。並行的東西就是在這種背景下變得重要的。

用 20 種語言寫同一個程式

克尼漢有個習慣:課堂上他會拿一個小例子,儘可能用不同的語言寫一遍。現在手上有二十個版本。

這個例子本身很無聊:讀入長度不一的文字行,把每行重新折成不超過 60 個字元。在一門語言裡大概十五行,別的地方也差不多。他關心的三件事是:程式碼多長,跑多快,學起來多痛苦。

這當然是極窄的樣本,但他有他的道理。"一門語言最難的一步,大概就是第一步。"他用這個小程式去邁那第一步,然後看自己經歷了什麼。

結果差異很大。在 Lua 裡,他下載了 Lua 環境,一個小時就做出來了,之前一輩子沒寫過 Lua。Scala 同樣簡單,他試了,卻花了幾個星期,而且跑得像烏龜。FORTRAN 90 很痛苦,但能跑。Rust 花了幾天,記憶體管理的模型對他有點陌生。他當時遇到的最大問題是找不到一致可用的文件,感覺手冊裡的一切都在快速變化,看起來能跑的示例,在他的語言版本上跑不起來。這件事發生在幾年前,他說現在應該穩定多了。

他的總結落到實處:你得有一件想做的事,還得有足夠可支配的時間,兩件都滿足,才值得去學一門新語言。光為了學而學,這事永遠不會發生。

那 JavaScript 呢?當年它被公認為最醜的語言之一,學術界提起它會嘲笑你,說它不配被學術研究。克尼漢認為相當一部分已經變了:語言本身在演進,編譯技術更是好得不可思議,所以前後端都已經是可行的方案。他自己寫過一些,也玩過一些翻譯器,但不是專家,這裡變化太多,他也跟不上。

庫的甜蜜負擔

Lex 問了一個很敏銳的問題:今天寫 Python 或 JavaScript,很大一部分體驗其實是在用別人寫好的庫,這和當年在 Unix 和 C 上從零開始搭東西,感覺完全不同。

克尼漢承認這是關鍵差異。舊時代程式設計之所以好玩,原因之一是你真的在全部自己搭,要處理的庫相當少,最多加一個標準庫。今天不是這樣。

他的描述很具體:這幾天的機器學習的嘗試裡,有東西不工作,你就 pip install 某個包,幾百兆的不知道什麼東西就下來了,你完全不知道它是什麼。運氣好它就能用,運氣不好你毫無辦法,而且你根本沒法從這一千個包裡找出是哪個出的問題。

他覺得 JavaScript 的 NPM 環境更糟,紀律和管控都更少。這類問題的後果不只是"你不懂它怎麼工作",還包括安全問題、健壯性問題。"所以,你不想用 JavaScript 去跑一個核電站,大概。"他說得像是玩笑,但半是玩笑的東西往往最真實。

AMPL:把數學翻譯給求解器

AMPL 是克尼漢參與設計的代數建模語言,和 Bob Fourer、Dave Gay 一起做的。這件事在他自己的說法裡,主要功勞也歸兩位搭檔:Bob 是西北大學工業工程與管理科學系的教授,Dave 是貝爾實驗室的數值分析和最佳化專家。

線性規劃是什麼?你有一堆決策變數,它們必須以某種方式組合,滿足一組約束,然後你要找到一個取值,讓某個目標函式最大或最小。教科書裡通常寫成:一個大矩陣 A,乘以向量 x,小於等於向量 b,再加一個目標函式,是若干 x 的線性組合。

問題在於真實世界裡的 A 非常龐大、非常稀疏、結構非常複雜,各個元件分散在係數裡,人幾乎沒法直接看懂。你在黑板上寫的是數學:"這一堆的和大於那一堆的和",而你真正需要的是把黑板上的數學直接寫成約束,再交給求解器。

Bob 長期以來對建模語言有興趣。當時已經有一個叫 GAMS 的通用代數建模系統,但語法像 FORTRAN,很笨重。1984 年,Bob 到貝爾實驗室做休假年,辦公室就在克尼漢對面,地理上非常近,於是兩個人加上 Dave 一起開始談這件事。

那種語言應該寫成什麼樣子?無非是像黑板上的代數式,用文字寫出來。克尼漢寫了 AMPL 的第一版,這也是他人生第一個 C++ 程式,大概三千行,不算大,但它證明了這件事可行:人可以自然地寫模型,機器能把它轉換成求解器能處理的東西。

關鍵設計是模型和資料分開。同一個模型可以用在完全不同的資料上,就像很多程式那樣。求解器負責所有硬活,AMPL 把求解結果轉換回你原來的形式,告訴你每樣東西該買多少、做多少、運多少。

Lex 提到他自己用 AMPL 時,會把模型發給確定沒程式設計背景的同事看,對方也能大致理解那個最佳化問題是什麼。一個語言能讓人讀懂問題本身,這件事比它跑得多快重要。

P 等於 NP 嗎?

Lex 逼克尼漢下注:你覺得 P 等於 NP 嗎?

答案是"不"。他說自己沒有直覺,但讀到的很多同行都這麼下注,這是流行看法。他還轉述了一個關於 Jeff Dean 的段子,問他在什麼條件下 P 會等於 NP,回答大概是"要麼 P=0 要麼 P=1 之類",克尼漢說自己記不清了,反正那人比他聰明太多。

克尼漢博士論文寫的是關於大 O 符號的東西,1968 年,早於計算複雜性理論的成形。他當時做的是圖劃分:給定一個有節點有邊的圖,邊有權重,你要把節點分成兩堆、大小相等,讓跨越兩堆的邊數儘可能少。這個問題很難。

他和 Shen Lin 在貝爾實驗室一起做,始終沒能找到任何保證給出正確答案的演算法。他們做出了效果相當好的啟發式方法,他也為論文挑出了一些特殊情形,但就是難。那個時間點,Steve Cook 正在證明有一類問題看起來真的很難,圖劃分是其中之一。

這裡有個細節值得琢磨。Lex 拿最大割作對比:最大割和圖劃分是同一個問題,只是不限制兩邊節點的數量,而一旦加上這個約束,它就變難了。約束的存在與否,把一個容易問題變成了難問題。

AI 的夏天、冬天和新夏天

1964 年,克尼漢在多倫多讀本科,畢業論文是一篇關於人工智慧的文獻綜述。那正好是 AI 的夏天,人們以為計算機什麼都能幹:機器翻譯、下棋、證明幾何定理,樣樣都能。他讀了《計算機與思維》那本論文集,某種程度也算喝了一點 Kool-Aid,人非常樂觀。

後來大家都知道了,當時以為幾年就能實現的東西,花了幾十年。下棋和下圍棋現在確實比人強了,機器翻譯也好了很多,但這背後是五六十年的進步、硬體的演進,以及大量可以用來學習的資料,再加上網際網路和開源讓開發者協作的基礎設施。

從這裡能抽出什麼教訓?克尼漢引用了科幻作家 Arthur Clarke 的一句話:一位德高望重的老人說某件事可能,他多半是對的;說某件事不可能,他幾乎肯定是錯的。但沒人知道時間尺度。

談到今天這波機器學習和神經網路,他說自己離專家非常遠,大部分是從學生那裡學的,學生們大概會對他學得這麼少感到失望。但他認為潛力很大,遊戲領域已經看到效果。同時他有一個實實在在的擔心:機器學習從我們給它的資料裡學,資料有問題,學到的東西就有問題。最明顯的例子就是偏見,如果資料因為歷史的對待方式而包含"某些人不如另一些人"這種明擺著錯誤的東西,機器學習就會把它傳播出去。

而這個擔心還有光明的一面。機器學習做的事,是把資料裡的偏見暴露出來,像一面鏡子照向我們自己的社會,從而幫我們去修正它。克尼漢說,如果它真的是這樣運作的,那會很棒。但他不知道它到底是不是這樣運作,或者反過來說,機器學習的機制會不會反而強化和放大過去就錯的東西。這件事必須嚴肅對待,不能含糊過去。

至於"造出人類水平的智慧需要什麼",他的回答非常乾脆:我完全不知道。

摩爾定律撞上原子

指數增長能永遠持續嗎?克尼漢給了個俏皮的回答:沒有哪個指數能永遠持續,總會在某處耗盡。但如果它持續得足夠久,那可能就是我們需要的全部了,反正跟我們沒關係了。

他注意到摩爾定律已經在變。處理器不再變快,於是人們把"同樣面積塞更多東西"的能力用在橫向增長上:一顆晶片上放更多處理器、更多記憶體。這會撞到限制嗎?大概會,因為總有一天你會逼近單個原子,得另想辦法繞過去。會不會找到繞過去的辦法?不知道。他說這話時還補了一句:"我剛說過,如果我說不會,我肯定會錯,所以也許我們會找到。"

那程式語言會怎麼變?他的判斷是,會延續一些領域已經出現的趨勢:更多程式設計由程式完成,更少由人完成;更多是宣告式,過程式的成分越來越少。你只需要說我想要這件事發生,由別的東西去搞清楚怎麼做。今天這在許多垂直領域已經是常態,領域特定語言的天下。可以想象這個範圍會變寬,你不需要寫那麼多細節,某個軟體集合會弄清怎麼做你想做的事。

一句話概括:抽象層次會繼續升高。高到某一天,也許就到了能用自然語言描述意圖的地方。

計算機如何改變了人與人

克尼漢在普林斯頓教一門叫"計算機與我們世界"的課,面向非技術學生,典型的是歷史系或英語系的人。他要講計算機如何工作、程式設計是什麼、計算機之間如何通訊、通訊的時候在幹什麼。

這門課裡有個設計很有意思:他會帶學生看一臺玩具機器,指令集很小,讓學生寫幾行彙編,理解最底層是什麼樣,計算機是如何用一小撮非常簡單的指令(加減、跳轉之類)把事做完的。然後往上走到 FORTRAN、C 這樣的高層語言,看抽象層次如何讓人更容易寫程式碼、更不依賴具體架構。最後再講他們天天在用的那些程式:手機上的作業系統、下載的 App,全都是我們剛說過的這類東西,只是規模巨大。

他承認這是要求學生從五行彙編跳到一個手機瀏覽器,概念跨度巨大。但本質上,它們是一回事。

那麼計算機到底怎麼改變了世界?克尼漢抓了一個角度:人與人之間的互動方式。

他小時候,打一個電話到某個地方是件大事,因為要花不少錢,那是 1960 年代。今天人們不打電話了,發簡訊。人們覺得和世界任何角落的朋友、家人定期通訊、開視訊會議,是理所當然的。

這對人是好是壞?他給了個兩面兼有的答案。他自己和加拿大的兄弟姐妹發電郵,比二十年前打電話頻繁得多,大概每兩三天就會收到或發出一封,這在某種意義上把他們拉得更近了,是好事。但他看著校園裡的孩子,大多低著頭盯著手機走,他得躲著走。社會學研究裡有人指出,人們實際上反而不如以前親近了。他不知道這是不是真的,但他能看見潛在的下行面。

更宏觀的一層,他看到的是雙面性。計算機給了人們改善生活的可能,這是好的。同時短期內也能看到大量壞的一面:人變得更部落化、更狹隘,而且數量龐大。人們用計算機去誤導、歪曲,或者乾脆對正在發生的事撒謊,這件事正在影響各地的政治。

Lex 補了一句:現在每個人都有了發聲的渠道,被壓迫的人有了聲音,這是強大的事。但每個人都有了聲音,隨之而來的混亂,看著既迷人又可怕。

大多數人不該學程式設計,但該懂程式設計

回到那個最普通的問題:所有人都該學程式設計嗎?

克尼漢的回答很剋制,也很明確:大概不該。但每個人都應該至少理解程式設計是什麼。這樣當有人對你說"我是程式設計師",你腦子裡有個大致的概念;當有人說"這是由計算機執行的程式決定的",你對那意味著什麼有一個模糊但準確的直覺。

他的這門課就是幹這個的,講計算機怎麼工作,講程式怎麼寫,講計算機之間怎麼對話。他坦白說,這門課上極少有人後來成為嚴肅的程式設計師。但至少他們對這一整套東西有了更好的認識,而且不只是程式設計,還包括背後的技術和通訊。

課程裡學生要寫一點程式,很少。他帶他們看清機器在高層語言之下是怎麼運作的。雖然嚴格說沒有"最低層",你總能再往下走,但他說,他在那裡畫了一條線。

那些真正開心的時刻

Lex 最後問,如果能回到過去重活一個瞬間,那個讓你真正快樂、或者深刻改變你的瞬間是哪一個?

克尼漢沒有給出某個具體時刻。他給出的是一類時刻,和地點繫結:在貝爾實驗室,你做出一件東西,它工作了,有人用了,說"這挺酷"。這種事在 1970 年代那個黃金時代發生得挺頻繁,Unix 還年輕,低垂果實遍地都是,一群人在一起,你做點東西,他們就會來試。

AWK 就是這樣一個例子。他做出的東西,全世界幾百萬人天天在用。他也因此把自己所有的愚蠢錯誤都擺在這些人眼前讓人看。他說這事既好又可怕。

Lex 把這一點說得很漂亮:它讓人脆弱,也美,因為它實實在在地影響了很多人。

克尼漢自己留在節目最後的那句話,只有七個字:"不要註釋糟糕的程式碼。重寫它。"

這句話可以當成他整場對話的一個總結。他不相信複雜的補救,不相信在壞東西上疊加解釋,不相信繞彎子。他相信的是把機制找對、把模型找對,然後讓一切自然地變簡單。這既是他參與締造 Unix 的方式,也是他看待程式設計、語言、工具、乃至技術與社會關係的方式。

如果你讀到這裡想做點什麼,下面這些是從這場對話裡能直接拿走的:

  • 花一個下午學會 AWK 和 grep。克尼漢說,按投入產出比算,它們大概是最值得學的工具。你不需要精通,會寫一行"從一堆文字里挑出某個東西並數一數",就足夠在日常裡反覆省時間。
  • 學一門新語言時,別從語法開始,從一件你想做的小事開始。讀入若干行、重新折行、輸出,這種十五行左右的程式,一小時能跑通的語言,往往在預設行為設計上做得好。
  • 寫程式碼之前先問清楚"這個問題真正要想清楚的是什麼"。克尼漢把這一步歸為藝術,把"怎麼做才做好"歸為科學。多數人跳過前者,直接進入後者,然後在錯的路上狂奔。
  • 接受"找到一個好模型"的價值。Unix 的檔案介面之所以強,是因為一個機制通吃了很多場景。你手上的系統如果能找到一把這樣的鑰匙,後面會省下大量重複解釋和重複實現。
  • 對庫保持敬畏,別一 install 就當它沒有。知道自己在依賴什麼,尤其是在安全敏感的場合。幾十兆你不認識的程式碼進到系統裡,這件事值得停一下想想。
  • 把資料當成一面鏡子。如果模型學到了奇怪的東西,先回去看資料裡有什麼,而不是先調模型。偏見在資料裡,它就會在學習結果裡。
  • 別給糟糕的程式碼寫註釋,重寫它。這一條適用面比程式設計寬得多。任何靠解釋維持的東西,都值得先問一句,能不能換一個模型讓它不需要解釋。
文稿由本站用語音識別模型(基於官方釋出音訊)機器轉寫,可能有識別錯誤,人名與數字請以音訊為準。
[00:00:00] The following is a conversation with Brian Kernahan, a professor of computer science at Princeton University. He was a key figure in the computer science community in the early 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 go programming language and his latest Unix A History and a memoir. [00:00:34] He co created the text processing language used by Linux folks like myself. He co designed ample and algebraic modeling language that I personally love and have used a lot in my life for large scale optimization. [00:00:49] 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 to new sponsors, the amazing self cooling ET Sleep Mattress and Rakan earbuds. Please consider supporting the podcast by going to a sleep dotcom slash leks and going to buy recontact leks click the links by the stuff. It really is the best way to support this podcast and the journey I'm on. [00:01:29] If you enjoy this thing, subscribe on YouTube. Review Five thousand app, a podcast supported on Patrón or connect with me on Twitter. Àlex Friedemann. 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 a sleep and it's incredible pod pro mattress that you can check out at 8:00, sleep dot com slash legs to get two hundred dollars off the mattress, controls temperature with an app and can cool down to as low as 55 degrees. [00:02:03] Research shows the temperature has a big impact on the quality of our sleep. Anecdotally has been a game changer for me. I love it. The PaPeRo 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 sleep app reminds me I should probably get on that. [00:02:31] 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 for a sleep pod prone mattress. Check it out, a sleep dotcom flex to get two hundred dollars off. This show is also sponsored by Rakan Earbuds, Get them at by Rakan Dotcom's Leks. [00:03:05] They have quickly become a main method of listening to podcasts, audio books and music, when I run, do the push ups 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 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. [00:03:39] 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 Khateeb. I don't even know Khateeb is. But her earbud game is on point to mention celebrities actually care about, I'm sure of Richard Feynman was still with us. He'd be listening to the Joe Rogan experience with Rick Ear Buds. Get them at Byrock on dotcom slash Lex, it's how they know I sent you and increases the chance they'll support this podcast in the future. [00:04:14] So for all of the sponsors, click all of the links. It really helps this podcast. And now here's my conversation with Brian again. [00:04:42] Eunuchs started being developed 50 years ago and more than 50 years ago. Can you tell the story like you describe in your book of how the universe was created? [00:04:52] Huh? If I can remember that far back, it was some while ago. [00:04:57] So I think the gist of it is that at Bell Labs in 1969, there were a group of people who had just finished working on the MultiChoice project, which was itself a follow on to success so we can go back sort of an infinite regress in time. But the success was a very, very, very nice time. Sharing system was very nice to use. I actually used it that summer. I spent in Cambridge in 1966. What was the hardware there? [00:05:25] So what's the operating system? Was the hardware there? What's the CTS look like? [00:05:29] So Seijas has looked like kind of like a standard timesharing system. Certainly at the time it was the only timesharing of no. [00:05:36] Let's go back to the basic what's the time for. OK, in the beginning was the word and the word and there was timesharing systems. Yeah. [00:05:44] 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. [00:05:59] And you used things like punch cards to write programs on talk to them so you would take a deck of cards, write you program on it, send it over a counter, read 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 that could be a long distance away. [00:06:28] It could be close. 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. [00:06:42] So I might be editing a file. So I would be typing. And every time I had a keystroke, the operating system would wake up and said, oh, he typed character, let me remember that. [00:06:50] Then he'd go back to doing something else would 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 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. [00:07:15] In a sense, the illusion, the feeling is that the machine is your own. [00:07:19] 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 access the compatable timesharing system was, I think arguably the first of these it was done and I guess technically 64 or something like that. It ran an IBM 1794, slightly modified to have twice as much memory as the norm. [00:07:49] It had two banks of 32 words instead of one. [00:07:54] So two words each word was thirty six bits of call it about 150 kilobytes times two. So by today's standards, that's down in the noise. At the time that was a lot of memory and memory was expensive. [00:08:10] So ZZZZZ was just a wonderful environment to work on. It was done by people that Mittie, led by Fernando CAPATO Korby, who died just earlier this year, and a bunch of other folks. [00:08:24] So I spent the summer of 66 working on that, had a great time, meant a lot of really nice people. [00:08:29] And indirectly, I knew of people at Bell Labs who were also working on a follow on to success that was called MultiChoice. [00:08:41] The MultiChoice was meant to be the system that would do everything that access did, but do it better for a larger population, all the usual stuff. [00:08:48] 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? [00:09:01] So the answer is, I don't have a clue. I think the basic idea is 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 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? [00:09:25] Or you text editing or are you compiling or something? And we might adjust the schedule according to things like that. [00:09:32] Okay, so MultiChoice was trying to just do some of the cleaning it up a little bit. [00:09:37] What was it was meant to be much more than that. So MultiChoice was the multiplexed information and. Puting 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. Yeah, same idea, but 50 odd years earlier. And so what MultiChoice 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. [00:10:13] 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, you know, and you never know how the magic works. You just kind of plug in and your little computation needs to perform and it does it. Was that the dream? [00:10:32] I don't know whether that was the dream. I wasn't part of it at that point. Remember, I was an intern for summer. [00:10:36] 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. [00:10:55] 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. [00:11:08] 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, Essence? [00:11:16] 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, a very fine city, living 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. [00:11:37] 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. [00:11:45] And that was kind of useful for the future. [00:11:48] So there's Bell Labs is this magical, legendary place. So first of all, whereas Bell Labs and. Can you start talking about that journey towards Eunuch's and 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 is actually that 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 about an hour north of here in Princeton. [00:12:28] And at that time, it had a 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. [00:12:58] So that that was the essence of Bell Labs. And again, I wasn't a permanent employee there. I was that was another internship. I got lucky. [00:13:05] And internships, I mean, if you could just lingering a little bit, what was the what was in the air there? Because some of the the number of Nobel Prizes, the number of Turing Awards and just the legendary computer scientist that come from their inventions, including developments, including Unix, is just as unbelievable. So was there something special about that place? [00:13:28] Well, I think there was very definitely something special I mentioned. [00:13:32] The number of people is a 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. [00:13:50] 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 optic cables or microwave systems, all of these things the labs worked on. [00:14:10] And it was kind of just the beginning of real boom times in computing as well as when I was there. [00:14:16] 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. [00:14:25] So how was Unix born? So MultiChoice, 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. [00:14:48] And so in roughly the beginning of 1969, Bell Labs pulled out of the project. [00:14:54] The project at that point had included MIT Bell Labs and General Electric. General Electric made computers of General Electric was the hardware operation. [00:15:05] So Bell Labs realizing this wasn't going anywhere on a time scale they cared about, pulled out of the project. And this left several people with an acquired taste for really, really nice computing environments, but no computing environment. [00:15:20] And so they started thinking about what could you do if you were going to design a new operating system that would provide the same kind of comfortable computing access had, but also the facilities of something like MultiChoice sort of brought forward. [00:15:36] 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 seven, where he started to do experiments with filesystems. Just how do you store information on a computer? 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. [00:16:04] So software productivity was good in those days as a PDP was the PDP seven cents a piece of hardware? [00:16:10] Yeah, it's a piece of hardware. It was one of the early machines made by Digital Equipment Corporation deck, and it was a mini computer so called it had I would have to look up the numbers. [00:16:24] Exactly, but it had a very small amount of memory, maybe sixteen k sixteen bit words or something like that. [00:16:30] Relatively slow, probably not super expensive. Maybe again making this up I'd have to look it up 100000 dollars or something like that, which is not super expensive enough. [00:16:40] That's right. It was expensive. [00:16:42] It was enough that you and I probably wouldn't be able to buy 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 use. 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 run through in three weeks because you are I mean, you're part of that process. [00:17:09] You contributed a lot to this early development. So what do you think it takes to do that first step, that first kind of from design to reality and the PDB? [00:17:22] 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. [00:17:30] And so I don't know. No operating system is simply code. And this first one wasn't very big, but it's something that lets you run processes of some. But you execute some kind of code that has been written that 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. [00:17:53] 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 in an assembler for the PDP seven that worked. He did a text editor so that you could actually create text. He had the file system stuff that he had been working on. [00:18:09] 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. [00:18:21] What was the code written in the primarily the programming language? [00:18:25] Was it in Assembly PDP seven assembly that Ken created? [00:18:30] These things were assembly language until probably the call it 1973 or 74, something like that. [00:18:38] 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. [00:18:48] It feels like impossible to do any kind of what we think of as software engineering the assembly, because to work on a big picture, sort of. I think it's hard. [00:18:58] It's been a long time since I wrote assembly language. It is absolutely true that in some language, if you make a mistake, nobody tells you there are no training wheels whatsoever. [00:19:06] And so stuff doesn't work now and you're not ebookers. 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. [00:19:22] Now, these systems were not big in the sense of today's picture. [00:19:25] I see 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 he's into now several leagues removed. [00:19:48] I know there's levels. Yes. 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, at the time, matters to the timing of when that person comes along and the a wife does have to leave. Like there's this weird timing that happens and then all of a 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 on a whim, but not really. [00:20:19] And of course, quickly, that is now you could think of most of the computers in the world run on a Unix like system, right? [00:20:28] What what how do you like if you kind of assume from the alien perspective, if you're just observing Earth, that also in these computers took over the world and they started from this little initial seed of Unix, how does that make you feel? [00:20:43] It's quite surprising. And you asked earlier about prediction. The answer's 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. [00:20:56] I suspect more of the latter. [00:20:58] And so I look at it and think, gee, that's kind of neat. [00:21:04] I think the real question is what they can think about that, because he's the guy arguably from whom it really came, you know, 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 Ken. [00:21:21] You've written in your book, UNIX, The History and the memoir. Are there some memorable human stories, funny or profound from that on that just kind of stand out? [00:21:31] Oh, there's a lot of them, in a sense. And again, it's a question of can you resurrect them in this memory fails. [00:21:38] But I think part of it was that Bell 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 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. [00:21:57] 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, rebellious and put in some kinds of ways. [00:22:12] 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 that they didn't really want to. [00:22:23] So maybe to linger on that a little bit, do you have a sense of what the philosophy that characterizes Unix is the design, not just the initial, but just carried through the years, just being there, being around? What's the fundamental philosophy behind the system? [00:22:40] 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. [00:22:50] 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 a which could be highly productive. [00:23:17] 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 that from his standpoint, the real goal was to create a community where people could work as programmers on a system. [00:23:34] 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 are of more and more stuff coming up that was really good for programmers. [00:23:56] And you were part of that community of programmers. So what was it like writing programs in that early universe? It was a blast. [00:24:03] It really was like, you know, I like the program. I'm not a terribly good person. 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, call 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. [00:24:33] You could do it, you know, and 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. [00:24:44] And and the feedback loop was then very, very short and tight. And so a lot of things got developed fairly quickly that. [00:24:54] 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 and 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 is part of the reward mechanism. [00:25:15] And what was the method of interaction, the communication with that feedback loop? [00:25:20] I mean, this is before the Internet, certainly before the Internet. It was mostly physical right there. [00:25:28] You know, somebody come into your office and say something. So these places are all closed, but like offices are nearby, really lively and interaction. Yeah. [00:25:36] Yeah, no, Bell Labs was fundamentally one giant building and most of the people were involved in this unique stuff in two or three quarters and there wasn't room. Oh. [00:25:45] How big was it. [00:25:46] 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. [00:26:00] And so there was it was mostly very physical. [00:26:03] We did use email, of course, and but it was fundamentally all for a long time, all on one machine. [00:26:11] So there was no need for Internet. It's fascinating to think about what computing would be today with our Bell Labs. It seems so many people being in the vicinity of each other, it's sort of getting that quick feedback working together since so many brilliant people. I don't know where else that could have existed in the world. And given how that came together. Yeah. How does that make you feel that that's that little element of history? [00:26:40] 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 PARC is perhaps the most obvious one. Xerox PARC contribute an enormous amount of good material. And many of the things 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 whoknows, but that would. [00:27:10] That's certainly another place where there was a tremendous amount of influence. There were a lot of good university activities and it was obviously no slouch in this kind of thing and others as well. [00:27:24] So Unix turned out to be open source because of the various ways that AT&T operated and sort of had to. It was the focus was on telephones. So I think that's a mischaracterization in the sense it absolutely was not open source. [00:27:40] 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 that 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. [00:28:08] The Berkeley version of Unix started with that license 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. [00:28:27] And there was an enormous amount of legal jockeying around this, that in the late, early to late 80s, early 90s, something like that. [00:28:36] And then not, I guess the open source movement might have started when Richard Stallman started to think about this in the late 80s. [00:28:46] 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. [00:28:59] He could see what to do because the kind of Unix system call interface and the tools and so on were there. [00:29:07] 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. [00:29:15] Linux. [00:29:15] Yeah, but 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's freely licensed, so it felt open source and because universities are not trying to make money. So there it felt open source in the sense that you can get access if you want it right. [00:29:37] 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. [00:29:44] And so technically not open, technically belonging to anti pragmatically pretty open. [00:29:51] And so there's a ripple effect that all the faculty and students can go up and they're the one throughout the world and permitting that kind of way. So what kind of features do you think makes for good operating system? If you take the lessons of Unix, you said, 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? [00:30:31] 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. [00:30:41] You couldn't do a lot of complicated things because you just didn't have the resources, i.e. the processor speed or memory. [00:30:49] And so that enforced a certain minimal 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 in its fundamental form is extremely straightforward, and that means that you can write code very, very effectively for the file system. [00:31:16] And then one of those ideas, one those generalisations, is that, gee, that file system interface works for all kinds of other things as well. [00:31:23] 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. [00:31:38] In effect, files in a file system in 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 that in planning a lot of different resources or 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. [00:32:05] And it means, therefore, that more people can do useful, interesting things with them without having 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 is a creativity or kind of rigour? [00:32:33] I think it's some of each. It's some combination of some of the art is figuring out what it is that you really want to do. What should that program be? What 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. [00:32:50] And I think that's that's art in many respects. The science part is trying to figure out how to do it well. [00:32:57] And some of that is a real computer science 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. [00:33:18] That kind of more formal view of it. [00:33:21] 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. [00:33:32] 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. [00:33:59] And if you're an artist, what's that? [00:34:02] So just on your own personal level, what's your process like writing a program, say, a small and large sort of tinkering with stuff and you just start coding right away and just kind of evolve iteratively with a loose notion? [00:34:20] 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 course as an undergrad or something like that? What's your process like? [00:34:31] 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 are 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. [00:34:56] 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 OK scripts, because two or three lines will tell you something about a piece of data. [00:35:21] 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 has been a long time since I wrote programs that were much more than that. [00:35:35] Speaking of data exploration and OK, first, what is OK, so AKA's a scripting language that was done by myself, El Eho and Peter Weinberger. [00:35:47] We did that originally in the late 70s was a language that was meant to make it 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 a command on each line of file. [00:36:08] And there's it's still exceptionally widely used today. Oh, absolutely. Yeah. [00:36:13] 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. [00:36:34] 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. [00:36:53] 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, OK? [00:37:01] 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. [00:37:11] So, yeah, I find I probably write more than anything else at this point. [00:37:15] So what kind of stuff do you love about, OK, 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 that, it is something that stands out particular features. [00:37:31] I think it's mostly the selection of default behaviors that you sort of hinted at it a moment ago. [00:37:38] What Arktos is to read through a set of files and then within each file it reads 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 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. [00:38:02] And that's all completely automatic. You don't have to say anything about it. You just write the pattern in 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. [00:38:17] And it does other things for free as well. It splits the data into fields so that on each line there's fields 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 as it goes along, like what line are we on? How many fields are there on this line? [00:38:35] So lots of things that just make it so that a program which in another language, let's say Python, would be five, 10, 20 lines in alkies, one or two lines. [00:38:45] 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 the is just directly. Yeah. [00:38:56] Is there other shell commands that you love? Over the years, like you really enjoy using oh, crap, that's the only one, yeah, grifter's everything. So grap is kind of what is that a simpler version of OK, I would say in some some sense. Yeah. Right. Because what is grap so grippe is it basically searches the input for particular patterns, regular expressions, technically a certain class and it has that same paradigm that Arktos. [00:39:25] 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 print it if it matches. [00:39:37] So it's in that sense it's a much simpler version. [00:39:39] And you could write crap in ORCA's as a one liner and I use grep probably more than anything else at this point just because it's so convenient and natural. [00:39:52] Why do you think it's such a powerful tool? Grap not. Why do you think operating systems like Windows, for example, don't. [00:40:00] Have it sort of you can, of course, I use, which is amazing, now there's Windows for Linux so like that which you could basically use all the fun stuff like I can grab inside of windows, but windows naturally, sort of as part of the graphical interface, the simplicity of grep, sort of searching through a bunch of files and just popping up naturally. Why don't you think that why you think that's unique to the Unix and Linux environment? [00:40:28] I don't know. [00:40:29] It's not strictly unique, but it's certainly focused there. [00:40:33] And 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 Kaminen and, you know, undoubtedly large number 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 to model of computing that where you point and click and sort of experiment with menus. [00:41:06] It's a model. [00:41:07] Computing works 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 to sometimes be an uphill struggle. [00:41:19] And so I think Microsoft probably was right and what they did. Now, you mentioned whistle or whatever it's called. [00:41:25] The next question I wonder, what's is that? I've never actually pronounced the whistle. I like it. I have no idea. [00:41:33] But there have been things like that for a long 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 something that's been going on for at least 20 years, if not longer. [00:41:47] 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. [00:42:04] But I should I would definitely recommend to people to if they don't use segment to try whistle. Yes. As a I've been so excited that I could use Barthélémy Bash write scripts quickly in windows. It's changed my life. [00:42:20] OK, what's your perfect programming setup. What computer. What operating system. What keyboard. What. Ed. Yeah, perfect is too strong a word. [00:42:30] It's way too strong a word of what I use 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 keyboards, OK? 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 higher ed. [00:43:05] I use mostly Sam, which is an Ed that Rob Pich wrote long ago at Bell Labs and that sorry to interrupt. [00:43:14] Does that proceed? Why post it? Post dates both V.I. and Emacs. It is derived from Rob's experience with Eddie EnVie de. That's the original Eunuch's Ed. Oh, wow. Dated probably before you were born. So what's that actually what's the history of Ed? Can you briefly? Because I used Emax. I'm sorry to say so. Sorry to come up with that. But what's what's the kind of interplay there? So, yeah. [00:43:52] So in ancient ancient times, like call it the first time sharing systems, going back to what you're talking about, there were editors, there was an editor on this that I don't even remember what it was called. [00:44:03] It might have been edit where you could type text program text and it would do something or document text. [00:44:10] You would save the text, save it, you could edit it. [00:44:13] 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. [00:44:33] OK, no, no CRT type displays, Lavonia LEDs. [00:44:38] And so then when Unix came along, Kinderhook took QED and stripped way, way, way down. [00:44:45] And that became an editor that he called it. And 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, you know, print ranges and 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. [00:45:06] They can work on a parts of a file. [00:45:07] Essentially, you could work on any part of it, the whole thing or whatever, but it was entirely command line based and it was entirely on paper. [00:45:17] My paper, and that meant that. Yeah, right, real paper. And so if you change the line, you had to print that line using up another line of paper to see what change caused. [00:45:28] OK, yeah. So, Wensing, 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 everything printing. [00:45:44] And one of there were a number of editors there, the one that I was most familiar with and still use is V.I., which was done by Bill Choi. And so that dates from probably the late 70s as a guess, and it took it full advantage of the cursor controls. [00:46:02] I suspected Emax was roughly at the same time, but I don't know. I've never internalized IMEX. [00:46:08] So so I use at this point I stopped using idealized can I use VI sometimes and I use Sam when I can. [00:46:17] And Sam is available on most systems. It was it is available. You have to download it yourself from typically the plan nine operating system distribution. It's been maintained by people there. And so I get home tonight. [00:46:30] I'll try it. It's the S. S fascinating, although my love is with Lisburn Emacs of went into that happy world of stuff. [00:46:42] I think it's of things. [00:46:43] What religion. Where you brought up. Yeah that's true. [00:46:45] 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 inless. [00:46:55] So can you take on the impossible task and give a brief history of programming languages from your perspective. [00:47:03] 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 calls and paper tapes, something like that. [00:47:22] So extremely tedious, awful, whatever. And so I think the first programming languages were. [00:47:29] Relatively crude assembly languages where people would basically write a program that would convert mnemonics like add add into whatever the bit pattern was that corresponded to an ad 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. [00:47:57] 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 in the paper just a couple of days ago, Tony Birchard died. He did this thing in Manchester called the called auto code, 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. [00:48:23] And it replaced a language that Alan Turing wrote, which you put in zeros and ones, but you put it in backwards order because that was hardware worked very hard. [00:48:31] That's right. Yeah, that's right. Backwards. [00:48:35] So assembly language is then let's call that the early 1950s. And so every different flavor of computer has its own assembly language. So the Ed Sacket, it's in a Manchester had it and the IBM whatever, 1790 or 704 or whatever hit it and so on. [00:48:51] So everybody had their own assembly line and assembly languages have a few commands, additions, traction, then branching of some kind if then type of situation. Right. [00:49:00] 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, that's nice, I'd like a different machine, start over. OK, so very bad. [00:49:23] 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. [00:49:37] 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 is to know that formula. [00:49:51] Translation That's what I stood for. I was COBOL, which is the common business oriented language that Grace Hopper and others worked on, which was aimed at business kinds of tasks. [00:50:01] There was ALGOL, 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. [00:50:11] And so all of those moved the level up. [00:50:13] 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. [00:50:28] I'm still used today as Fortran probably. Oh yeah, COBOL too. But the deal was that once you moved up that level, then you let's call it Faulknerian. You had a language that was not tied to a particular kind of hardware because different compiler would compile for different kind of hardware. And that meant two things. It meant you only had to write 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 might not be as good as you'd get through a programmer, but it was pretty good. [00:51:03] And so it democratized and made much more broadly available the ability to write code. [00:51:08] So it puts the power of programming into 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. [00:51:20] 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 were necessary to write so-called system programs, things like text editors or assemblers or compilers or operating systems themselves, those kinds of things. [00:51:43] And Fortran 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 have a process and it's a different flavor. [00:51:53] What they're doing. They're much more in touch with the actual machine in it, 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 the way and more ways to structure, organize data. And so the system programming languages. There was a lot of effort in that in the call it the late 60s, early 70s iest. [00:52:19] I think the only real survivor of that. [00:52:23] And then what happens after that? You get things like object oriented programming like. [00:52:28] Just 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. [00:52:45] And so then it took off from there. I mean, there's also a parallel, slightly parallel track with a little bit of the functional stuff with Lisp and so on. But I guess from that point is just an explosion of languages. The Java story, there's the JavaScript, there is all the stuff that the cookies these days are doing with the rest and all that. Yeah. So what's to use here? You wrote a book C programming language. What in C is probably one of the most. [00:53:12] 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 that you could rewrite things in a pretty natural way and efficiency, which was particularly important when computers were not nearly as powerful as they are today. [00:53:42] Put yourself back 50 years almost in terms of what computers could do. And that's, you know, roughly four or five generations to decades of Moore's Law. Right. [00:53:54] 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 which was Unix, the operating system itself was portable, as were all the tools. [00:54:15] So it all worked together again in one of these things where things feed on each other in a positive cycle. [00:54:23] What did it take to write sort of a definitive book, probably the definitive book on all of programming, 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. [00:54:39] And at least from my perspective, maybe you can correct me in 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 working on that? [00:54:55] Is some kind of joke? [00:54:58] No, of course not. The next. It's an accident of of timing, skill and just luck. [00:55:05] A lot of it is clearly timing was good. Now, Dennis and I wrote the book in 1977 on this. [00:55:11] 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. [00:55:20] And C was also available on other kinds of computers that had nothing to do with Unix. [00:55:25] 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. [00:55:37] 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 reading. 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 least I guess, of going first is that then other people have to follow you if they're going to do anything. [00:56:01] And I think it worked well because. Dennis was a superb writer, 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. [00:56:15] So just crystal clear prose. Very, very well expressed. [00:56:19] And then he and I wrote most of the expository material, and then he and I sort of did the usual ping ponging back and forth of, you know, refining it. [00:56:30] 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. What 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. [00:56:45] What do you think is the power of example? [00:56:47] I mean, you're you're the creator, at least one of the first people to do the Hello World Program, just 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 world. [00:57:07] So what? And that's a representative examples of what what do you find powerful about examples? [00:57:13] 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. [00:57:27] And so a lot of the examples in the 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. [00:57:40] There's a copy command. I want to read input and do something to it and write it out again. There's a grip. [00:57:46] 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. [00:58:02] And I think that a lot of programming books that I do, I don't look at programming books a tremendous amount these days. But when I do, a lot of don't do that. [00:58:11] They don't give you examples that are both realistic and something you might want to do. Some of them are pure syntax. [00:58:20] Here's how you add three numbers will come on. I could figure that out. Tell me how I would get those three numbers into the computer and how he would do something useful with them and then how I put them back out again. [00:58:31] Neatly formatted, and especially if you follow the example, there is something magical of doing something that feels useful. Yeah, right. [00:58:38] And I think it's the attempt is 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 goal language. That admits I worked at Google for a while and I've never used go well, you missed something. [00:59:11] Well, I know I've missed something for sure. I mean, so go and rush the two languages that I hear very spoken very highly of, and I wish I would like to try. Well, there's a lot of them. There's Julia. There's there's all these incredible modern languages. But if you can comment before or maybe comment on what do you find, where does go sit in 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 now because of time? [00:59:48] So I think so. [00:59:49] Go, go first comes from that same Bell Labs tradition in part not exclusively, but two of the three creators, Ken Thompson and Rob Place. Literally the people. Yeah, the people. [01:00:02] And then with this very, very useful influence from the European school in particular, the close influence through Robert Greaseman, who was, I guess, the second generation down student at. And so that's an interesting combination of things. [01:00:20] And so some ways I go captures the good parts of C. It looks sort of like C. It's sometimes characterized as C for the 21st century. [01:00:31] On the surface, it looks very, very much like C. But at the same time, it has some interesting data structuring capabilities. [01:00:38] And then I think the part that I would say is particularly useful and again, I'm not a go expert in spite of coauthoring the book, about 90 percent 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 basically the cooperating, communicating sequential processes that Tony Hawk set forth. [01:01:06] Jeez, I don't know, 40 plus years ago. [01:01:09] 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. [01:01:24] So I think that's one place where go stands out that that model of parallel computation is very, very easy and nice to work with. [01:01:33] Just to comment on that, do you think she foresaw or the early Unix days for sore threads and massively parallel computation? [01:01:42] 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. [01:01:52] Processor's got faster and then processors stopped getting faster because of things like power consumption and heat generation. [01:02:03] And so what happened instead was that instead of processors just getting faster, there started to be more of them. And that's where that parallel thread stuff comes in. [01:02:14] So if you can comment on the all the other languages that break your heart, then you'll never get to explore them. Or how do you feel? A lot of the full variety? [01:02:24] It's not breaking my heart, but but I would love to be able to try more of these languages. The closest I've come is in 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 languages at this point and and that. [01:02:49] So I do a minimal experiment with a language just to say, OK, I have this trivial task which I understand the task and it should. [01:02:56] It takes fifteen lines, an arc and not much more in a variety of other languages. [01:03:01] So how big is it, how fast does it run and what pain did I go through to learn how to do it? [01:03:08] And that's a it's like Antec data, right? [01:03:12] It's a very, very, very narrowly lead data. I like that. So, yeah, but it's 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 there you're taking the first step. Yeah. And so my experience with some languages is very positive, like Lua, a scripting language I never used and I took my little program. [01:03:36] The program is a trivial format or it just takes in lines of text of varying lengths and it puts a mote in lines that have no more than 60 characters on each line. So I think it was just kind of the flow process in a browser or something. So it's very short program. And in Lua I downloaded Lewine in an hour. [01:03:57] I had it working, never having written, lured my life, just going with all my documentation. I did the same thing in Skalla, which you can think of as a. Flavor of Java, equally trivial. I did it in high school, it took me several weeks, but it did run like a turtle and and I did it in Fortran 90. [01:04:21] And it was 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 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. [01:04:38] Now, this was several years ago and I'm sure things have stabilized. But at the time, everything in the Restoril seemed to be changing rapidly. And so you would find what looked like a working example and it wouldn't work with the version of the language that I had. [01:04:51] So it took longer than it should have rushed 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, I want to do it. [01:05:05] And yet I have enough disposable time, whatever to make it worth learning a new language at the same time. [01:05:13] It's never going to happen. So what do you think about another language of JavaScript that this. Well, let me just sort of comment on what I said when I was brought up, sort of JavaScript was seen as the probably like the ugliest language possible, and yet it's quite arguably quite possibly taking over not just the front and the back end of the Internet, but possibly in the future, taking over everything because they've now learned to make it very efficient. [01:05:44] Yeah. And so what do you think about this? [01:05:46] Yeah, well, I think you captured a lot of ways when it first came out. JavaScript was deemed to be fairly irregular in 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. [01:06:00] I think a lot of that has evolved. 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 backhands as well as the front end used. [01:06:18] Well, I think it's a pretty good language. [01:06:20] I've 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. [01:06:34] So I don't know whether it will ever take over the world, I think not, but it it's certainly an important language and worth knowing more about. There's there's maybe to get your comment on something which JavaScript and actually most languages of Python, such a big part of the experience of programming with those languages includes libraries sort of 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 CCDs when you're building stuff from scratch. [01:07:10] What do you think about this world of essentially leveraging, building up libraries on top of each other and leveraging them? [01:07:16] Yeah, that's a very perceptive kind of question. And one of the reasons programming was fun in the old days was that you were really building it all yourself. [01:07:26] 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. [01:07:33] And that is not the case today. [01:07:35] And if you want to do something in you mentioned Python and JavaScript and those are the two fine 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. [01:07:52] And gee, 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. [01:08:03] 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. [01:08:12] And I think it's worse in the NPM environment for JavaScript. [01:08:17] I think there's less discipline, less controller. [01:08:20] And there's aspects of not just not understanding how it works, but there are security issues as robustness issues. So you don't want to run a nuclear power plant using JavaScript? [01:08:29] Essentially, I probably not. So its 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 or three programming languages that you mentioned to the bell days when people could sort of the community of it and the more languages you have, the more you separate the communities, 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? [01:09:04] I certainly don't hope you're 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. [01:09:15] But I think if you look at the sort of the distribution of how they are used, there's something called a dozen languages that probably account for 95 percent of all programming at this point. [01:09:28] And that doesn't seem unreasonable. [01:09:30] And then there's another well, two thousand languages that are still in use that nobody uses and or at least don't use in any quantity. [01:09:40] But I think new languages are a good idea in many respects because they're often a chance to explore an idea of how a language might help. [01:09:50] 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. [01:10:07] Let me just go back as early as recursion lisp and and follow forward functions as first class citizens and pattern based languages and I don't know, closures. [01:10:19] And just on and on and on lambdas. Interesting ideas that showed up first in, let's call it broadly the functional programming community and then find their way into mainstream languages. [01:10:30] Yeah, it's a it's a playground for rebels. Yeah, exactly. [01:10:34] And 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. [01:10:47] So let's go to something that when I found out recently. So I know 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 you fabulous for minimizing functions. [01:11:03] Yeah. Minimizing functions. [01:11:04] Right, exactly. I can just say that the elegance in abstraction, power of example is incredible. When I first came to it about 10 years ago or so, can you describe what is the ample language. Sure. [01:11:22] 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. Some sort of system of constraints so that you have a bunch of things that have to be less than this, greater than that or 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. [01:11:59] And it specifies that there's objective function constraints and variables that become separate from the data it operates on. [01:12:07] Right. So the that kind of separation allows you to, you know, put on different hats. One, put the hat of an optimization person and then put another hat of a data person and dance back and forth and and also separate the actual solvers, the optimization systems that do the solving. Then you can have other people come to the table and then build their solver, whether it's linear or nonlinear, convex, non convex, that kind of stuff. [01:12:38] So of what is the use? [01:12:44] Maybe he can comment how you got into that world and what is the beautiful or interesting idea to you from the world of optimization? [01:12:52] Sure. So I preface it by saying I'm absolutely not an expert on this. [01:12:57] And most of the important work in Apple comes from my two partners in crime on that, Bob Forer, who was a professor of in the Industrial Engineering and Management Science Department at Northwestern, and my colleague at Bell Labs, Dave Gay, who was a numerical analyst and optimization person. So the deal is linear programming. Preface this by saying, let's stay with linear programming. Linear program is the simplest example of this. So linear programming is taught in school is that you have a big matrix which is always called A and you say X is less than or equal to be so B as a set of constraints, X is the decision variables and as to how the decision very pulls are combined to set up the various constraints. [01:13:41] So as a Matrix and X and B your vectors and then there's an objective function which is just the sum of a bunch of X's and some coefficients on them. And that's the thing you want to optimize. [01:13:54] The problem is that in the real world, that Matrix A. has 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 obvious to anybody. [01:14:12] And so what you need is some way to express the original model, which you and I would write. [01:14:18] You know, we'd write mathematics on the board. The sum of this is greater than the sum of that kind of thing. [01:14:23] So you need a language to write those kinds of constraints. And Bob, for 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 Gamze, the general algebraic modeling system, but it looked very much like Fortran was kind of clunky. And so Bob spent a sabbatical year at Bell Labs in 1984, and he and I was in the office across from me. [01:14:49] And it's always geography. [01:14:52] And he and Dave 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, some Asian 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. [01:15:18] 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 a mathematical expressions in a Fortran like an algebraic but textural like language. And I wrote the first version of this AMPOULES program, my first C++ program, and it's written in C++. [01:15:45] And so I did that fairly quickly. We wrote it was, you know, 3000 lines or something. [01:15:50] 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 convert it into something the solver could work with. [01:16:01] The same time, as you say, that model and the data are separate things. So one model would then work with all kinds of different data in the same way, lots of programs do the same thing, but with different data. [01:16:11] So one of the really nice things is the the specification of the models human just kind of like, as you say, human readable. Like I literally I'm urban stuff. I work. I, I would send it to colleagues that I'm pretty sure never programmed. [01:16:26] And they're like just just to understand what optimization problem is I think. [01:16:33] 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? [01:16:41] 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 and just some representation. [01:16:52] Or if you're doing things that are not linear programming, then there may be some mechanism that lets you provide things like functions to be called or other constraints on the model. [01:17:04] So so all Apple 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, Apple converts those back into your original form. [01:17:17] So you know how much of each thing you should be buying or making or shipping or whatever. [01:17:23] So we did that in 84 and I haven't had a lot to do with it since, except that we wrote a couple of versions of a book on which is one of the greatest books ever written. [01:17:33] I love that book. [01:17:35] I don't know why it's an excellent book, but for most of it. And so it's really, really well done. It must be a dynamite teacher and typeset in latex. No, no, no. [01:17:45] Are you kidding? However, like in the typography. So I don't know. We did it with Dero. I don't even know what that is. Yeah, exactly. Yeah. [01:17:55] I think it's draft is as a predecessor to the tech family of things, it's a formatter that was done that believes in this same period of the very early 70s that predates tech and things like that by five to 10 years. [01:18:12] But it was nevertheless just I'm going by memories. It was I remember it being beautiful. Yeah, it was nicely moving outside of Unix Sea Org going. [01:18:20] All the things you talked about, all the amazing work you've done, you've also done working graph theory. [01:18:29] Let me ask this, 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 on P? [01:18:40] The answer is no, although I'm told that somebody asked Jeff Dean if that was under what conditions be legal in P, and he said either P zero or in his one or vice versa, I've forgotten is a lot smarter than I. [01:18:54] Yeah. [01:18:57] So but your intuition is I have no I have no intuition, but I read a lot of colleagues who've got intuition that their betting is. [01:19:04] No, that's the popular that's the popular bet. [01:19:08] OK, so what is computational 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? [01:19:23] I don't do that stuff. [01:19:24] 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 Ph.D. thesis on four big notation, you know, absolutely. Before I did this in 1968. [01:19:41] And I worked on graph partitioning, which is this question. You've got a graph that is 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. [01:19:59] So that problem is hard. [01:20:03] Well, as it turns out, I worked with Shamblin at Bell Labs on this and we were never able to come up with anything that was guaranteed to give the right answer. [01:20:11] 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. [01:20:19] 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 witchcraft. [01:20:25] Partitioning was one. [01:20:27] But this my expertise, such as it was, totally predates that development. [01:20:33] I think. So the heuristic, which now carries the two years names for the traveling salesman problem 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 no such idea, a heuristic that kind of does the job pretty well. [01:20:51] You're trying to find eat something that did the job and there was no nothing that you would call that's a closed form or algorithmic thing that would give you a guaranteed right answer. [01:21:01] I mean, compare graph partitioning to Max Flamin Cut or something like that, because 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. [01:21:22] Yes, the Robert Frost has that poem. We had to choose two paths. So why did you. [01:21:29] Is there another alternate universe in which you pursued the Don Knuth path of, you know, algorithm designs and are not smart enough, smart enough or you're infinitely modest, but so you procedure kind of love of programming. [01:21:48] I mean, when you look back to those, I mean, just looking into that world, does that just seem like a distant world of of theoretical computer science then? Is it fundamentally different from the world of programming? [01:22:01] I don't know. I mean, certainly, in all seriousness, I just didn't have the talent for it. I when I got here as a grad student at Princeton and I started to think about research at the end of my first year or something like that, I worked briefly with John Hopcroft, who is absolutely you know, you mentioned Turing Award winner, etc., a great guy. And it became crystal clear I was not cut out for this stuff, period, OK? [01:22:26] And so I moved into things where I was more cut out for it. [01:22:30] And that tended to be things like writing programs and ultimately writing books. [01:22:37] You've said that in Toronto as an undergrad, you did a senior thesis or literature survey on artificial intelligence. This was 1964, correct. [01:22:49] What was the A.I. landscape ideas, dreams at that time? [01:22:54] I think that was one of the well, you've heard of A.I. Winters. This is whatever the opposite was, a summer or something. [01:23:00] 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. [01:23:09] They will do machine translation. [01:23:11] They will play games like chess and they will do, you know, prove theorems and geometry. [01:23:19] There are all kinds of examples like that where people thought, boy, we could really do those sorts of things. [01:23:26] And, you know, I read the Koolaid in some sense, 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, I was more than a few years down the pike. [01:23:48] 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 than people do. But there are others on machine translation is a lot better than it used to be. [01:24:02] But that's, you know, 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. [01:24:16] And the the infrastructure to support developers working together like an open source move. The Internet period is also empowering. But what lessons do you draw from that? The opposite of winter, that optimism? [01:24:31] Well, I guess that the lesson is that in the short run, it's pretty easy to be too pessimistic or maybe too optimistic 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 Clarke, science fiction author, who says, you know, when some distinguishment elderly person says that something is erm is possible, he's probably right. [01:24:58] And if he says it's impossible, he's almost surely wrong. But you don't know what the timescale is. Timescales. All right. [01:25:05] So what are your thoughts on this new summer of A.I. now in the work with machine learning in your networks, you've kind of mentioned these studies 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 day to write programs from the data. [01:25:31] Yeah, look, I think it's very interesting. I am incredibly far from an expert. [01:25:36] Most of what I know, I've learned from my students and they're probably disappointed in how little I've learned from them. [01:25:43] But I think it has tremendous potential for certain kinds of things. [01:25:47] I mean, games is one where it obviously has had an effect on some of the others as well. [01:25:53] I think there's and this is speaking from definitely not expertise. I think there are serious problems in certain kinds of machine 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. To 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 at men as men. [01:26:21] It's something that's just flat wrong. But if it's in the data because of historical treatment, then that machine learning stuff will propagate that. [01:26:32] And that is a serious worry. And the positive part of that is what machine learning does is reveal the bias in the data and puts a mirror to our own society and in so doing, helps us remove the by. [01:26:48] Helps us work on ourselves. It 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, you know, the mechanisms of machine learning mechanisms reinforce and amplify things that have been wrong in the past. And I don't know. I but I think that's a serious thing that we have to be concerned about. [01:27:15] Let me ask you another 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. About image recognition, but really the dream is to create a human level, a superhuman level intelligence. What do you think it takes to do that? And are we close? [01:27:40] I haven't a clue. And I don't know. Roughly speaking, I mean, this was trying to trick you into hypothesising I mean, Turing talked about this in his paper on machine intelligence back, and she's an early 50s or something like that. [01:27:53] And he had the idea of the Turing test. [01:27:55] And I don't know what the Turing test is. It's a good test of and I don't know, it's an interesting test. At least it's in some vague sense objective. Whether you can read anything into the conclusions is a different story. [01:28:07] Do you have worries, concerns, excitement about the future of artificial intelligence? 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? [01:28:31] It's some combination of those. [01:28:33] 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. [01:28:47] And computing is is one of those. And A.I. within it is going to be one of those as well. [01:28:53] But computing broadly, I mean, for just a two day example, there's 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, you know, businesses, government, whatever, than perhaps one ought to feel comfortable with. [01:29:16] So that's an example. That's an example of a possible negative negative effect of computing being everywhere. It's it's an interesting one because it could also be a positive coverage correctly. There's a big effort there. [01:29:35] So I, I you know, I've I have a deep interest in human psychology in humans. There seem to be very paranoid about this data thing. [01:29:44] I it but that varies depending on age group. Yes. 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 on their head based purely on human psychology versus actual concerns or not. [01:30:02] Yeah. What do you think about Moore's Law? Well, you said a lot of stuff. We talked you talked about programming languages in their design and their ideas are coming from the constraints and the systems they operate in. Do you think Moore's Law, the the exponential improvement of systems will continue indefinitely? [01:30:25] There's there's a mix of opinions on that currently. Or do you think. Do you think there will be. Do you think there will be a plateau? [01:30:36] Well, the frivolous answer is no exponential can go on forever. [01:30:41] Run out of something, just as we said, time, scale, matters of if it goes on long enough, that might be all we need. [01:30:48] Right. Won't matter to us. [01:30:50] So I don't know. We've seen places where Moore's Law has changed. For example, I mentioned earlier processor processors don't get faster anymore, but you use that same growth of, you know, ability to put more things in a given area to grow them horizontally instead of vertically, as it were. [01:31:08] So you can get more and more processors or memory or whatever on the same chip. [01:31:12] 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. [01:31:22] Will we find some way around that? [01:31:24] I don't know. I just said that if I say it won't, I'll be wrong. [01:31:27] So perhaps we will. [01:31:29] So I just talked to Jim Keller and he says 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 increase still decrease and threaten Jazzercise. So possible. Before we get to the Quantum of Solace, there's still a lot of possibilities. He thinks he'll continue indefinitely, 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? [01:32:04] What do you think? Do you think there'll be a fundamental change in the way programming languages are designed? I don't know. [01:32:12] But 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. [01:32:34] You figure out how and that is in many cases, this point domain of specialized languages for narrow domains. [01:32:45] But you can imagine that broadening out. [01:32:48] And so I don't have to say so much in so much detail. [01:32:52] Some collection of software, let's call it languages or reprograms programs or something, will figure out how to do what I want to do. [01:33:02] So increased levels of abstraction. Yeah. And one day, getting to the human level, maybe we can just use that would be possible. So you taught so teach a course computers in our world here at Princeton that introduces computing and programming to non Meijers. What just from that experience? What advice do you have for people who don't know anything about programming but are 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? [01:33:35] Yeah, well, I could recommend a good book. Was that the book I wrote for the court? [01:33:41] 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 they 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. [01:34:09] So part of what I'm doing in this course, which is very definitely for non-technical people, I mean, typical person, and 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 they do when they're talking to each other. [01:34:31] And then I would say nobody very rarely does anybody in that course go on to become a real serious programmer. [01:34:41] But at 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. [01:34:49] Do they write a do they try and write a program themselves? Oh, yeah. Yeah, very small amount. [01:34:55] I introduce them to how machines work at a level below high level language. [01:35:00] So we have a kind of a toy machine that has a very small repertoire. [01:35:03] It doesn't instructions and they write trivial assembly language programs that wow, that's just if you were to give a flavor of the people of the programming world, of the computing world, what are the examples? Should go with a little bit of assembly to to get a sense at the lowest level of what the program is really doing. [01:35:25] 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 draw the line. [01:35:32] So the idea that computers have a fairly small repertoire of very simple instructions that they can do like add and subtract and and branch and so on, as you mentioned earlier, and that you can write code at that level and it will get things done. [01:35:50] 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. [01:36:03] 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 Mac OS on their computers or maybe Windows and they're downloading apps on their phones. [01:36:18] And all of those things are programs that are just what we just talked about except at a grand scale. [01:36:25] And it's easy to forget that they're actual programs that people program. There's engineers. I wrote about those things. Yeah, right. [01:36:31] And so in a way, I'm expecting them to make an enormous conceptual leap from their five or 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. [01:36:48] But but it's really the same thing. [01:36:51] So if you look at the broad in broad strokes of 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, uh, like you mentioned, the students are more distracted looking at their now there's a device to look at. Right. Well, I think computing has changed a tremendous amount, obviously. [01:37:19] 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 cost serious money. And this was in the 60s. Right. [01:37:37] And today, people don't make phone calls. They send text or something like that. So there's a up and down in what people do. [01:37:46] People think nothing of having correspondence, regular meetings, video or whatever with friends or family or whatever in any other part of the world. [01:37:57] 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 to this, does it take us away from the closeness of human to human contact? [01:38:16] 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. [01:38:31] Whereas 20 years ago I probably wouldn't have talked to them on the phone nearly as much. [01:38:37] So in that sense, I brought my brother and sister and I closer together. That's a good thing. [01:38:42] 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. [01:38:51] 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. [01:39:03] I don't know whether that's really true, but but I can see potential downsides and kids where you think, come on, wake up and smell the coffee or whatever. [01:39:13] That's right. But if you look at again, nobody can predict the future. But are you excited? Kind of touched just a little bit. They are. But are you excited by the future in the next 10, 20 years that computing will bring. [01:39:28] You were there when there was no computers and now computers are everywhere, all over the world and Africa and Asia and just every every person, almost every person in the world has a device. So are you hopeful, optimistic about their future? I it's mixed if the truth be told. [01:39:49] I mean, I think there are some things about that that are good. I think there's the potential for people to improve their lives all over the place. [01:39:56] And that's obviously good. [01:39:58] And at the same time, at least in the short time, short run, you can see lots and lots bad as people become more tribalistic or parochial in their interests. And it's an enormous amount more of them. And people are using computers and 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. [01:40:22] Yeah, the the long term effect on political systems and so on. So who knows. Knows indeed. [01:40:30] Uh, the the 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 from that is fascinating to watch. Yeah. Yeah. It's kind of scary. [01:40:47] 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 or moments that jump out at you from memory? [01:41:03] 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 hard at work. [01:41:13] So the moment the work used it. Yeah. And somebody used it and they said, gee, that's neat. [01:41:18] Those kinds of things happened quite often in that sort of golden era in the 70s when Unix was young and it was all this low hanging fruit and interesting things to work on a group of people who kind of we were all together in this. [01:41:34] And if you did something, they would try it out for you. [01:41:37] And I think that was in some sense a really, really good time. [01:41:41] And all. Was Bozak an example of that when you built that and people use that? Yeah, absolutely. [01:41:47] And now millions of people, his and all your stupid mistakes are right there for them to look at. So it's mixed. Yeah, it's terrifying. Vulnerable, but beautiful because it does have a positive impact. And so, so many people. So I think there's no better way to end it. Brian, thank you so much for talking. It was an honor, OK? [01:42:07] My pleasure. Good fun. Thank you for listening to this conversation with Brian Kern and thank you to our sponsors, a sleep mattress and Rickon earbuds. Please consider supporting this podcast by going to a sitcom, Lex and to buy Rakhat dotcom slash. Lex, click the links, buy 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. [01:42:44] If you enjoy this thing, subscribe on YouTube, review it with five stars, an app, a podcast supported on Patrón or connect with me on Twitter. Àlex Friedman spelled somehow miraculously without the letter E, just F.R. ID man, 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 Conaghan. [01:43:10] Don't comment. Bad code. Rewrite it. Thank you for listening and hope to see you next time.

本集資源與出處