Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
LINUX系統程式設計 第二版
by
Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from
LINUX系統程式設計 第二版
22
|
第一章
行程間通訊
允許行程之間交換資訊,並通知對方事件的發生,是作業系統最重要的工作之一。
Linux
核心實作了以往
Unix
所採用的
IPC
機制—包括
System V
與
POSIX
所定義及標準
化的機制—並且實作了若干自己的機制。
Linux
所支援的
IPC
機制包括:導管(
pipe
)、具名導管(
named pipe
)、旗號
(
semaphore
)、訊息佇列(
message queue
)、共用記憶體(
shared memory
)以及快速用
戶空間上鎖(
futex
)
7
。
標頭檔
Linux
系統程式設計會用到一些標頭檔(
header
)。核心本身及
glibc
都有提供系統程式
設計所要用到的標頭檔。這些標頭檔包括標準
C
所需要的部分(例如,
<string.h>
)以
及
Unix
通常會用到的部分(例如,
<unistd.h>
)。
錯誤處理
不用說,錯誤的檢查及處裡也具有至高無上的重要性。在系統程式設計中,錯誤的通知
係經由函式的傳回值,而錯誤的描述則是經由特殊變數
errno
。
glibc
會以透明的方式為
程式庫和系統呼叫提供
errno
的支援。本書所提到的介面絕大多數都會使用此機制來通
知所發生的錯誤。
函式會經由一個特殊的傳回值來通知呼叫者發生錯誤的事實,這個傳回值通常是
-1
(實
際會使用哪個值,因函式而異)。此錯誤值只用來警示呼叫者有錯誤發生了,並沒有提
供任何足以洞察錯誤為何發生的訊息。
errno
變數可用來找出錯誤發生的原因。
此變數宣告於
<errno.h>
,如下所示:
extern int errno; ...
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.
Start your free trial
You might also like
優雅的SciPy|Python科學研究的美學
Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
成為卓越程式設計師的38項必修法則
Pete Goodliffe
深入理解運算原理|從簡單的機器到無所不能的程式
Tom Stuart
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
Publisher Resources
ISBN: 9789862769812