Skip to content
yucing edited this page Jun 17, 2022 · 3 revisions

第十八週筆記

xv6 檔案系統

  • 共分 7 個層次
7. File Descriptor (file.c/FILE)       // ftable.file 是 struct file (FILE) 的陣列
                                       // fd 就是其索引值

6. Pathname (fs.c/namei+dirlookup)     // 透過 namei() 查找對應某路徑的 inode

5. Directory (fs.h/struct dirent)      // 目錄以 dirent 形式存在 inode 中

4. Inode (fs.c/struct inode/dinode)    // 一個檔案對應一個 inode

3. Logging (log.c)                     // 日誌,防止寫到一半出現狀況。

2. Buffer cache (bio.c)                // 區塊讀取函數 bread(dev, i)/bwrite(dev, i) 
                                       // 有緩衝功能。

1. Disk (virtio_disk.c)                // 透過 virtio 協定請求讀寫硬碟

xv6 中斷

RISC-V

  • 有兩個中斷器

1.局部中斷 CLINT (Core Local Interruptor)

  • 軟體中斷 (Software Interrupt) 和時間中斷 (Timer Interrupt),發生後會立刻執行
  1. 外部中斷 PLIC (Platform-Level Interrupt Controller)
  • 外部設備的中斷,像是磁碟,鍵盤,網路的中斷,必須經過仲裁決定哪個中斷優先處理
Clone this wiki locally