陳毅
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
8
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# UNIX、BSD 與 Linux 的愛恨情仇 各位知道 UNIX 作業系統的誕生僅是因為工程師想要拿來打遊戲嗎? 或又知道 C 語言是為何而生的? 如果都不知道,歡迎來到 Ian 的知識講堂(?),本篇會用說故事的方式跟大家聊聊 UNIX、BSD 與 Linux 的發展與糾葛。 > BTW: 筆者最近開始經營個人的[技術粉專](https://www.facebook.com/AwesomeCS-100681602024246/),如果大家喜歡這類的技術文章或是小故事,歡迎按讚追蹤唷! ## UNIX 的前世今生 在聊到 UNIX 之前,我們先來認識 UNIX 的前身: **Multics** 。 ### 多工資訊與計算系統 MULTiplexed Information and Computing System , 簡稱 Multics ,這個計畫於 1964 年啟動,由貝爾實驗室、麻省理工學院以及美國奇異公司參與研發。該計畫志在打造出一個分時多工的作業系統,然而,由於其開發進度緩慢,該計畫於 1969 年被終止。 ### 可以說是早有預謀,亦或是一時興起,讓我們談談工程師的玩物: UNIX 。 Multics 原本在一台型號為 GE-645 的電腦上開發,在該計畫結束後, Ken Thompson 在 GE-645 上開發了一套帶有檔案系統與記憶體分頁機制的 Emulator 。不只如此,他也開發了一個名為 B 語言的程式語言並利用它撰寫一款太空旅行遊戲。 ![GE-645](https://i.imgur.com/XDWs3xt.png) > 這個幾乎佔滿整個空間的厚重機器,就是用來開發 Multics 的電腦。 巨大的計算機帶來了驚人的耗電量,肯每次運行他**自幹**的太空旅行遊戲就會花費 75 元美金,不久後, GE-645 也被收走了。 無奈之下,肯在實驗室找到了幾台沒有人使用的舊電腦: DEC PDP-7 ,並且,肯開始嘗試用 PDP-7 的組合語言重新撰寫太空旅行這款遊戲。 ![](https://i.imgur.com/xsQWWXf.jpg) > 是的, PDP-7 我本人啦。 隨後,肯找來了 Multics 計畫的原班人馬以及新夥伴 Rudd Canady ,開始嘗試為 PDP-7 打造一款專屬的作業系統。 在開發期間內,肯發現要編寫驅動程式來驅動檔案系統進行測試並不容易,於是開發出了殼(shell)與部分驅動程式,做出了作業系統的雛形。 Multics 的許多功能都被沿用並且重構,最後,開發團隊做出了一個分時多工的作業系統,成為第一版的 UNIX 。 > 因為Multics來自「MULTiplexed Information and Computing System」的縮寫,在 1970 年,那部 PDP-7 卻只能支援兩個使用者,彼得·紐曼(Peter G. Neumann)戲稱他們的系統其實是:「UNiplexed Information and Computing System」,縮寫為「UNICS」。於是這個專案被稱為 UnICS(Uniplexed Information and Computing System)。 > -- [wikipedia](https://zh.wikipedia.org/wiki/UNIX) 因為 PDP-7 的效能不佳,開發團隊決定將 UNIX 移植到 PDP-11/20 上,開發第二版 UNIX 。在效能提升後,團隊才將 UnIcs 正名為 **UNIX** 。 ### 學生們的惡夢: C 語言 最初, UnICS 的一些應用是由 B 語言和組合語言混合撰寫的。考量到平台的可移植性,肯與里奇對其進行改造並於 1971 年共同發明了 C 語言。 此外,肯和里奇在 1973 年用 C 語言重構了 UNIX ,該版本作為第三版的 UNIX 。在當時,為了效能問題,系統程式都是由組合語言編寫的,肯和里奇的舉動可以說是跨時代的創舉。用 C 語言編寫的 UNIX 有著代碼簡潔、易移植、易讀、易修改的優點,為 UNIX 的發展奠定了優良的基礎。 ### 一篇論文,聲名大噪。 在 1974 年,肯與里奇在 ACM 投稿了一篇關於 UNIX 的論文: [The UNIX TimeSharing System](https://dsf.berkeley.edu/cs262/unix.pdf)。該篇論文讓外界認識了 UNIX ,也是從這時開始, UNIX 被教育機構以及公家機關所採納。 1975 年, UNIX 陸續發佈了 4 、 5 、 6 版,在 1978 年時,全球已經有 600 多台運行 UNIX 作業系統的裝置。 80 年代開始, UNIX 8 、 9 、 10 版只授權給了少部分的大學作為教育與研究用途。 ### System V UNIX 的結束 2005 年 8 月,貝爾實驗室中,當年負責研發 UNIX 與維護工作的 1127 部門正式宣告解散。肯選擇退休並居住在加州,里奇則轉調至別的部門, System V UNIX 也隨著 1127 部門關閉而停止更新。 ## 分道揚鑣, BSD 的誕生 1982 年, AT&T 基於 UNIX 7 開發了 UNIX System Ⅲ 的第一個版本,這是一個僅供販售目地的商業版本。 在當時為了解決 UNIX 版本混亂的情況, AT&T 綜合了其他大學和公司開發的各種 UNIX ,釋出了 UNIX System V Release 1 。 也因為 UNIX System V Release 1 不在包含先前 UNIX 的原始碼,讓 UC Berkeley 選擇繼續開發 BSD UNIX 將其作為 UNIX System III 和 V 的替代品。 ### TCP/IP 的領跑者: BSD TCP/IP 絕對是 BSD 為作業系統發展帶來的最大貢獻,沒有之一。 > BSD 有 8 個主要的發行版中包含了 TCP/IP: 4.1c 、 4.2 、 4.3 、 4.3-Tahoe 、 4.3-Reno 、 Net2 、 4.4 以及 4.4-lite 。這些發布版中的 TCP/IP 代碼幾乎是現在所有系統中 TCP/IP 實現的前輩,包括 AT&T System V UNIX 和 Microsoft Windows 。 > -- [wikipedia](https://zh.wikipedia.org/wiki/UNIX) ### NET2 與官司問題 繼 NET1 版本後, BSD 開發團隊開始將 BSD 中大量關於 AT&T 的代碼移除,像是重新撰寫了 Vi 編輯器: NVi 。開發團隊於 1991 年 6 月發佈了 BSD NET2 ,其原始碼僅剩部分核心文件保留了 AT&T 的程式碼。 > Net/2 成為 Intel 80386 構架上兩種移植版的主要組成部分,包括由 William Jolitz 負責,自由的 386BSD ;以及專屬的 BSD/OS ,由 Berkeley Software Design(BSDi)負責。 386BSD 本身雖然短命,但在不久之後成為了 NetBSD 和F reeBSD 原始代碼的基礎。 > --[wikipedia](https://zh.wikipedia.org/wiki/BSD) 這樁訴訟案推遲了兩年才在 1994 年 1 月了結,判決結果對 UC Berkeley 有利。柏克萊套件的 18000 個檔案中,只有 3 個檔案被要求刪除、 70 個檔案被要求修改並標明 USL 的著作權說明。 這項調解還要求, USL 不得對之後的 4.4BSD 的使用者和開發者提起訴訟。 ### BSD 的開枝散葉 1994 年 6 月, 4.4BSD 以兩種形式發布: - 可自由再發布的 4.4 BSD-Lite 4.4 BSD-Lite 不包含 AT&T 的原始碼。 - 4.4 BSD-Encumbered 與先前版本一樣,遵照 AT&T 的授權條款。 UC Berkeley 的最終版本是 1995 年發布的 4.4 BSD-Lite Release 2,隨著 CSRG 解散,在 UC Berkeley 的 BSD 開發也告一段落。也是基於 4.4 BSD 的套件,讓 BSD 的諸多分支 ( FreeBSD 、 OpenBSD 和 NetBSD )得以繼續維護。 ![](https://i.imgur.com/u6L6639.png) > 圖為 UNIX 譜系,取自維基百科。 ## 自由軟體運動與 Linux 的誕生 在談 Linux 之前,我們必需要先知道偉大的**自由軟體運動**。 ### 自由軟體運動與理察·斯托曼 ![](https://i.imgur.com/QZjmo0H.png) > 自由軟體運動是一個推廣使用者有使用、複製、研究、修改和分發軟體等權利的社會運動。接近和相關的運動包括開放原始碼運動及自由軟體的開放原始碼運動。這運動跟 1970 年代的駭客文化有淵源,而理察·斯托曼是該運動的主要發起人以及精神領袖。 談到自由軟體運動,就一定要知道在該運動底下催生的[ GNU 計畫](https://zh.wikipedia.org/wiki/GNU)。 GNU 計劃是由理查·斯托曼在麻省理工學院的人工智慧實驗室發起。其中,理查希望發展出一套完整的開源作業系統來取代 UNIX ,該作業系統被稱為 GNU 。 ### 理想與現實的差異 可惜,現實與理想總是會有一些差別,在現實生活中, GNU 作業系統的開發時程緩慢,多半使用 Linux 以及 FreeBSD 作為作業系統的核心。 不過, GNU 計畫仍大大的影響我們的開發者世界,不止有有作業系統, GNU 計畫由多個工具所組成,像是: - GNU 編譯器套裝 GCC - GNU 的 C 函式庫 glibc - GNU 核心工具組 coreutils - GNU Debugger: GDB 等等,並且大部分的工具都被移植到了其他作業系統上,在開發者圈中發光發熱。 ### 一場官司,成就 Linux 在前面提到, USL 以及 UC Berkeley 的法律訴訟長達 2 年才以和解收場,這也讓自由軟體的開發延遲了兩年,進而讓沒有法律問題的 Linux 核心獲得了極大的支援。 Linux 跟 386BSD 的開發幾乎同時起步( Linux 於 1991 年開發),作者 Linus 更是這麼說過: 當時如果有基於 80386 平台的自由類 UNIX 作業系統,他可能就不會打造出 Linux 了。 就技術上來看, Linux 是一個符合 [POSIX](https://zh.wikipedia.org/wiki/%E5%8F%AF%E7%A7%BB%E6%A4%8D%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E6%8E%A5%E5%8F%A3) 標準的作業系統核心。它提供了一套完善的 API 給開發者使用,讓使用者能透過介面程式與核心及硬體互動。 ### GNU Linux 與 Linux 作業系統的命名爭議 除了上面提到的 Linux 核心,還有一套以 Linux Kernel 為核心打造的作業系統: Linux 作業系統。開發者圈也為了 Linux 作業系統應該叫 GNU Linux 還是 Linux 而大動肝火。 > GNU / Linux 這一名稱是由自由軟體基金會的創立者與 GNU 計劃的發起人理察·斯托曼所提出的。 GNU 的開發者與其支持者,希望以該名稱來作為此作業系統的正式名稱。他們認為,此作業系統,包括了 GNU 系統軟體套件與 Linux 核心,使用 GNU / Linux 這個名稱,可以良好概括它的主要內容。況且, GNU 計畫原本就是以發展一個自由的作業系統為遠程計畫,但遲遲沒有完成。而 Linux 核心的出現剛好可以補足這個缺口。 > -- [wikipedia](https://zh.wikipedia.org/wiki/GNU/Linux%E5%91%BD%E5%90%8D%E7%88%AD%E8%AD%B0) 然而, Linux 核心並不是 GNU 計劃的一部份,所以 GNU Linux 這個名稱在 Linux 社群中並沒有得到一致認同。有趣的是, Linux 核心專案的發起人林納斯·托瓦茲偏好於使用 Linux ,但對於 GNU / Linux 這個名字並不抱有反感。 > 這可以說是粉絲比偶像本人還生氣嗎 XD ## 總結 筆者希望能夠藉由本篇文章讓大家知道生活中常用到的 GCC ,甚至是大家口中的類 UNIX 系統是什麼。 或許,在閱讀這些歷史後,學習 C 語言時會比較不感到枯燥乏味(?) > 如果覺得冗長的文字過於枯燥,大家也可以參考交大學生製作的[影片](https://www.youtube.com/watch?v=Ttsz-h81R54)。 ## Reference - wikipedia - [淺談 Microkernel 設計和真實世界中的應用](https://hackmd.io/@sysprog/microkernel-design)

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully