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系統程式設計 第二版
行程管理
|
185
如下的調用:
pid_t pgid = getpgrp ();
等效於:
pid_t pgid = getpgid (0);
它們都會傳回「進行叫用之行程的」行程群組識別碼。函式
getpgid()
不會失敗。
監控程式
監控程式
daemon
)就是一個在背景中運行的行程,它不會連接到任何控制終端機。
監控程式一般會啟動於開機時期,並且會以
root
或其他特殊用戶(例如
apache
postfix
)的身份運行,而且所處理的是系統層級的任務。按慣例,監控程式的名稱通常
會以字母 d 結尾(例如
crond
sshd
),但是這並非必要或甚至不具普遍性。
daemon 這個名稱源自於 Maxwell
s demon(馬克斯威爾的小妖),這是
物理學家 James Maxwell 1867 年所提出的一個想法。demon(精靈)
還是希臘神話中超自然的存在,祂存在於人和神之間並且具有天賦的力量
和神的知識。不同於猶太教和基督教所教導的 demon(惡魔),希臘的
demon(精靈)並不必然是邪惡的。的確,在希臘神話中,demon 往往
會幫奧林匹斯山眾神完成祂們不願意做的事—這與 Unix daemon(監
控程式)為前景用戶完成其想要避免之工作非常像。
監控程式通常需要符合兩項需求:它必須是 init 的一個子行程,以及它不得連接到一個
終端機。
總之,一個程式完成以下步驟就可以變成一個 daemon
1. 叫用
fork()
。這會建立一個新的行程,這個新行程將變成 daemon
2. 在父行程中呼叫 ...
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

AGILE學習手冊 | SCRUM、XP、精實和看板方法

AGILE學習手冊 | SCRUM、XP、精實和看板方法

Andrew Stellman, Jennifer Greene
管理Kubernetes

管理Kubernetes

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

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

George T.Heineman, Gary Pollice, Stanley Selkow

Publisher Resources

ISBN: 9789862769812