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系統程式設計 第二版
122
|
第四章
從而很難找到可用之大型的連續區域。當然,此問題極少出現在使用
64-bit
位址空
間的狀況下。
•
建立和維護記憶體映射以及核心內部相關的資料結構是要付出代價的。此開銷通常
會與「所省去的雙重副本開銷」兩相抵銷,尤其是對較大型與被頻繁存取的檔案
而言。
所以,當所映射的是大型的檔案(因此所浪費的空間佔整個映射相當小的比例)或所映
射之檔案的大小是頁面大小的整數倍(因此沒有浪費任何空間),將可從
mmap()
的優點
獲得最大的好處。
調整一個映射的大小
Linux
特有的
mremap()
系統呼叫可用於擴大或縮小所指定之映射的大小:
#define _GNU_SOURCE
#include <sys/mman.h>
void * mremap (void *addr, size_t old_size,
size_t new_size, unsigned long flags);
mremap()
可把位於
[addr,addr+old_size)
區間的映射擴大或縮小成新的大小
new_size
。
同一時間,核心可能會移動此映射,這取決於行程之位址空間中的可用空間以及
flags
的值。
[addr,addr+old_size)
中,左邊的
[
符號用於指定此區間的開始位址(含
該位址),右邊的
)
符號用於指定此區間的結束位址(不含該位址)。這
個慣例就稱為區間標記法(
interval notation
)。
flags
參數可以是
0
或是
MREMAP_MAYMOVE
(指出,如果有需要,核心可以自由移動映射,
以便進行所要求之調整大小的操作) ...
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