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系統程式設計 第二版
62
|
第二章
之所以會把
pselect()
加入
Unix
的工具箱,背後的主要動力是增加了
sigmask
參數,其
目的在避免「等待檔案描述器」與「信號處理」(第
10
章將有深入的探討)之間的爭用
情況。假定信號處理程序(
signal handler
)會設定一個全域旗標(多半會這麼做),而
且行程在叫用
select()
之前會檢查此旗標。現在,假設信號是在檢查之後及呼叫之前抵
達的。應用程式可能無限期受到阻擋,而無法對所設定的旗標做出回應。
pselect()
呼叫
可以解決這個問題,其做法是為叫用
pselect()
的應用程式提供一群受阻檔的信號。受
阻擋的信號不會被處理,除非它們已不再受阻擋。一旦從
pselect()
返回,核心會回復
舊的信號遮罩(
signal mask
)。
直到
2.6.16
版核心,
pselect()
的
Linux
實作並非系統呼叫,而是
glibc
所提供之
select()
的簡單包裹函式。此包裹函式可儘量避免—但是無法完全消除—產生此爭用情
況的風險。如果能夠引進真正的系統呼叫,將可完全避免爭用情況。
儘管
pselect()
中做了一些(相對較小的)改進,但是多數應用程式,無論是出於習
慣,或者是基於可移植性,仍繼續使用
select()
。
poll()
poll()
系統呼叫是
System V
的多工式
I/O
解決方案。它解決了
select()
的若干缺點,
然而
select()
仍舊經常被用到(同樣地,多半是出於習慣,或者是基於可移植性):
#include <poll.h>
int poll (struct ...
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