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系統程式設計 第二版
進階的行程管理
|
191
處理器密集及 I/O 密集行程
會持續耗用所有可用時段的行程稱為
處理器密集
processor-bound
)。此類行程極度
渴望 CPU 時間,而且會用完排班器指派給它的所有時段。最簡單的例子就是一個無窮
迴圈。
// 100% 處理器密集
while (1)
;
其他的例子包括科學計算、數學計算以及影像處理。
另一方面,會花比較多的時間在等待資源的行程稱為
I/O
密集
I/O-bound
)。 I/O 密集
行程常會進行和等待檔案或網路 I/O、等待鍵盤的輸入或者等待用戶移動滑鼠。I/O 密集
應用程式的例子,包括只會送出系統呼叫,要求核心進行 I/O 的公用程式,例如
cp
mv
,以及把許多時間花在等待用戶輸入的 GUI 應用程式。
處理器密集及 I/O 密集應用程式的差異在於,排班器會以對它們最有利的方式來調整排
班的行為。處理器密集應用程式渴望儘可能獲得最大的時段,這讓它們得以(透過時間
局限性)最大化快取區的命中率,以及讓它們的工作能夠盡快完成。相對而言,I/O
集行程不一定需要較大的時段,因為在它們送出 I/O 要求以及等待某個核心資源之前,
它們一般會運行一段非常短的時間。然而,I/O 密集行程將得利於排班器的優先關注。
如果受阻檔以及派送多個 I/O 要求之後,此類應用程式越快重新開始,則它越能善加利
用系統的硬體。此外,如果應用程式需要等待用戶的輸入,則它越快被排班,用戶對執
行未間斷的感受也越大。
要同時滿足處理器密集及 I/O 密集行程的需要並不容易。事實上,多數應用程式既是 ...
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