NFS Remote Operations
NFS remote operations 是 client 把 ordinary file-system operations 轉成 NFS RPCs。除了 NFS v3 沒有 open() / close(),許多 UNIX operations 可對應到 RPC;但實作上會用 caching、read-ahead、delayed writes 減少 network round trips。
Remote-service baseline
最簡單 model 是每次 lookup / read / write 都送 RPC 到 server。語意清楚但 latency 高,尤其 small operations 和 path lookup 會很慢,所以實際 NFS 依賴 client-side caches。
Caches / optimizations
- Attribute cache:cache size、timestamps、permissions 等 inode-like info;timeout 或 server attribute mismatch 時 revalidate / discard。課本提到 timeout 可約 60 seconds。
- File-block cache:若 attributes 顯示資料仍有效,read 可由 local cache 回覆。
- Read-ahead:預抓 sequential blocks,改善 sequential throughput;prediction 錯則浪費 bandwidth / cache。
- Delayed writes:先在 client cache 合併小 writes,再 flush 到 server;server confirm 前,client 不能丟掉 dirty blocks。
Weakened consistency
Caching / delayed writes 讓 NFS 不完全符合 D-OS-Ch15ga-UNIX_Semantics:新檔案或 writes 可能不會立刻被其他 clients 看見。它也不是純 D-OS-Ch15gb-Session_Semantics;可見性取決於 cache timeout、attribute validation、flush timing。
NFS 用 caching 換 practical performance,因此 sharing semantics 會比 strict local UNIX semantics 弱。