Introduction to Mosix
How to Implement Process Migration
89013900 周恩冉
從 Cluster 談起
- Cluster 是什麼?
- Cluster 的優點:
- RMS: Resource Management and Scheduling
- 著名的 cluster 系統
- UC Berkley NOW
- NASA Beowulf
Process Migration
- Process Migration 是什麼?
將運作中的 process 搬到不同的機器上繼續運作
- Process Migration 的優點:
- 動態負載平衡
- 容錯
- 高可用性
- 並行 IO
- 充分利用特殊資源
- ...
Mosix
- 易用、透明
- 提供 kernel 級的 process migration
- 應用程式不需重新 compile
- SSI (Single System Image)
- 動態負載平衡
- 平均分布負載
- load calculation algorithm
- 各個節點獨立計算如何遷移
Mosix (continue)
- 分散式控制、高伸縮性
- 沒有主從關係
- 節點可自己加入或退出
- 不需知悉整個系統的狀態
- DFSA 支援
- 並行存取
- Cache 一致
- 將需要 IO 的 process 遷移至資料所在地
代理、遠端機制
- Home node
- Remote
- user space 的封裝,code, stack, data, register, mem, process state ...
- 在各節點間遷移。
- Deputy
- kernel space 的封裝,process dependency, kernel stack ...
- 不可遷移的,留在 Home node.
代理、遠端機制﹝續﹞
- 大多數的計算都在 user space
- Linux 中透過 system call 才能進入 kernel mode, 攔截,透過 link layer 傳到遠端,如此即可將 process 切成兩部份。
- deputy 沒有自己的計憶體空間,使用 kernel 的計憶體,類似 kernel thread.
- 若 system call 頻繁則網路所帶來的延遲亦相當可觀,使用 cache 降低網路負擔。
Link Layer
- Base on TCP/IP
- 提供類似 BSD socket 的函式
- 位於 kernel space, user space 看不見
- 每個點有唯一的編號,由「一」開始連續分配,「零」表目前節點
Migration Daemon
- 初始化
- start_kernel
- init
- init_mosix
- mosix_mig_daemon
- mosix_info_daemon
- mosix_mem_daemon
Migration Daemon (continue)
- mosix_mig_daemon
- listen for migration reqest
- fork (user_thread)
- parent continue listern
- child call mig_remote_receive_proc (receive mm, vma, fp, process context...)
- child becomes remote
Migration
- 選擇要遷移的 process 及目標節點
- 向目標節點發出請求及協商
- 傳送 process 狀態
- 恢復執行 (remote)
Migration (continue)
- 發出請求的 process 成為 deputy
- 進入 kernel mode deputy_main_loop
- 等待 remote request
- 被 mosix_mig_daemon fork 出來的 process 成為 remote
Migration Restriction
- SYSV IPC
- Device Memory
- 8086 mode
- init
- Migration Daemon
- Memory locked by mlock
- Realtime process
- ...
System call
- Mosix 定義了 remote_sys_call_table, 並修改了 ENTRY(system_call)
- 本地端的非 remote process 不受影響
- remote process 則使用 remote_sys_call_table
- 通常是 remote 發送請求給 deputy, deputy 再呼叫 home node 端的 system call