Skip to Content
LINUX系統程式設計 第二版
book

LINUX系統程式設計 第二版

by Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from LINUX系統程式設計 第二版
第五章
行程管理
正如第 1 章所述,除了檔案,行程也是 Unix 系統中最基礎的抽象概念。因為目的碼
object code)會進入執行(execution)—活躍(active)、活著(alive)、運行程式
running program)—的狀態,所以行程不止是組合語言;它們組成自資料、資源、狀
態以及一個虛擬化的電腦。
本章中,我們將看到行程的基本功能,從建立到終止。自從最早期的 Unix 問世以來,它
的基本功能幾乎就未再變過。本章的主題—行程管理—便閃爍著歷史悠久的 Unix 原始設
計之前瞻性思維的光芒。Unix 行走了一條很少人走過的道路,它把新行程的建立與新二
元映像的載入分開。儘管這兩項任務多半是一前一後依序完成的,不過分開進行之後,
這兩項任務的試驗和發展將可獲得很大的自由度。這條很少人走過的道路讓 Unix 存活至
今,儘管多數作業系統均使用單一系統呼叫來啟動一個新程式,但是 Unix 卻需要用到兩
個:fork 以及 exec。在我們說明這兩個系統呼叫之前,讓我們先深入研究行程本身。
程式、行程以及執行緒
二元檔
binary
)是蟄伏在磁碟之類儲存媒體上經過編譯的可執行碼。一般來說,我
們也會使用
程式
program
)這個術語;我們會把大型和重要的二元檔稱為應用程式。
/bin/ls
/usr/bin/X11
皆為二元檔。
行程
process
)是一個正在運行的程式。一個行程不僅包含了被載入記憶體的二元映
像,還包括更多其他東西:虛擬記憶體的一個實例、核心資源(像是已開啟的檔案) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

深入理解運算原理|從簡單的機器到無所不能的程式

深入理解運算原理|從簡單的機器到無所不能的程式

Tom Stuart
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow

Publisher Resources

ISBN: 9789862769812