Created
March 5, 2015 02:54
-
-
Save robertu7/9549dcd37625ecf0a721 to your computer and use it in GitHub Desktop.
「理解 Linux 進程」筆記
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PID:標識和區分進程的 ID | |
- 隨機分配 | |
- PPID:父進程的 ID | |
* PID 為 1 的進程由內核創建的 init 進程 | |
進程狀態 | |
- R(running, 0) | |
- S(sleeping, 1) | |
- D(disk sleep, 2):不可中斷睡眠狀態 | |
- T(stopped, 4) | |
- t(tracing stop, 8) | |
- X(dead, 16) | |
- Z(zombie, 32) | |
- 進程狀態切換 | |
退出碼:根據退出碼知道進程正常運行與否,為0-255 的整數 | |
- 0: 正常退出 | |
- 2: 異常退出 | |
進程文件:/proc/PID | |
死鎖 | |
- 定義:一個進程拿著資源 A 請求資源 B,另一個進程拿著資源 B 請求資源 A,皆不釋放各自資源,導致雙方無法繼續進行 | |
POXIS (Portable Operating System Interface) 標準:Linux 與其他 Unix-like 系統共同 API 約定 | |
孤兒進程:父進程終止後仍然繼續運行的進程 | |
殭屍進程 | |
守護 (Daemon) 進程:常駐後台的進程 | |
- nohup | |
- disown | |
進程間通信 (IPC, Interprocess Communication):共享內存,信號燈或套接口 (Socket) | |
- 共享內存 | |
- 信號燈:調用 wait 時計數減一,到零時阻塞進程 | |
- 套接口 (Socket):通過網絡通信,不要求進程在同一台機上 | |
信號:內核給進程發送的消息,也可用於進程間通信 | |
- 列出信號種類:kill -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment