Block I/O Fundamentals
BasicBasic

Block I/O Fundamentals

Keywords

block deviceIOPSbandwidththroughputlatencysynchronous I/Oasynchronous I/OinterruptpollingAsk ChatGPT

Prerequisites

None — this is a starting concept.

Progress

Sign in to track your progress.

在作業系統中,我們透過 block device abstraction 將底層儲存裝置抽象為固定大小的 block 來存取,這是所有儲存系統的基礎。我們需要理解兩個關鍵的效能指標:IOPS 衡量每秒能完成多少次 I/O 操作,而 bandwidth 衡量每秒能傳輸多少資料量——不同的工作負載會瓶頸在不同的指標上。在 I/O 模型方面,synchronous I/O 會讓呼叫的 thread 等待操作完成才返回,而 asynchronous I/O 允許我們發出請求後繼續做其他事情,等完成時再處理結果。此外,裝置完成 I/O 後通知 CPU 的方式也有兩種:interrupt 由裝置主動觸發通知,而 polling 則是由 CPU 不斷檢查完成狀態。理解這些基本概念,是我們後續學習 NVMe、io_uring 等現代高效能 I/O 技術的必要前提。

Key Concepts

我理解 block device abstraction 如何將底層儲存裝置抽象為固定大小的 block,以及為什麼這是所有儲存系統的共同基礎

我理解 IOPS 與 bandwidth 這兩個效能指標的差異,以及不同工作負載(random small I/O vs. sequential large I/O)分別會受限於哪一個指標

我理解 synchronous I/O 與 asynchronous I/O 的差異,知道 synchronous I/O 會阻塞呼叫端直到完成,而 asynchronous I/O 允許提交後繼續執行其他工作

我理解 interrupt 與 polling 這兩種 I/O completion notification 機制的運作方式與適用場景,知道 interrupt 由裝置主動通知 CPU,而 polling 由 CPU 主動檢查完成狀態

Recommended Resources

Test Your Understanding