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系統程式設計 第二版
第九章
記憶體管理
對一個行程而言,記憶體是最基本而且是最重要的資源。本章將說明此項資源的管理,
包括記憶體的分配、操作以及最後的釋出。
動詞「allocate」(分配) —取得記憶體的常用術語—有些誤導,因為它會讓人有「需求
超過供應而對不足的資源進行限額配給」的印象。用戶當然都會喜歡記憶體越多越好。
然而,在現代的系統上,真正的問題不是所需要的太多、所分配到的太少,而是如何適
當地使用與記錄所分配到的記憶體。
本章中,你將學到在程式中各個區段分配記憶體的所有方法,包括每種方法的優缺點。
我們還會看到如何設定和操作任何的記憶體區段,以及如何鎖住記憶體,讓資料逗留在
RAM 中,使得程式的執行不必等待核心把資料所屬的頁面從置換空間(swap space)換
RAM
行程位址空間
Linux,如同任何現代的作業系統,會虛擬化它的實體記憶體。行程不會直接定址實體
記憶體。事實上,核心會把每個行程關聯到獨一無二的
虛擬位址空間
virtual address
space
)。此位址空間是
線性的
linear
),而且位址始於零,可遞增至某個上限值。此
位址空間也是
扁平的
flat
):它存在於單一空間,可以直接存取而不需要劃分區段
segmentation)。
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