1. IPC建構於Message-passing-system系統之上。
2. mesaage passing system可以分做:
(1). persistent asynchronous communication
(2). persistent synchroinous communication
(3). transient asyncronous communication
(4). transient synchronous communication
3. transient與 persistent 差別在傳送後的訊息是否保存到接收端接收到才清除為止;persistent 方式會保存資料直到接收端接收到資料為止,transistent則是發現當接收端無法接收資料,自動將資料清除掉。
synchronous communication 也稱做blocking communocation傳送端會等到確定接收端已接收到資料後才會往下執行接下來的task,相對地asynchronous communication則是傳接收端均不特別等待此筆資料的傳送,各自執行預定要執行的task。
4. UDP 通訊屬於 第 (3) 類的通訊方式,因此傳送端只管現在有資料要傳,但不管對方是否確實有收到。
5. 傳送端與接收端必須先建立一個Link,Link可以分做:
(1). direct與 indirect : direct link 必須指定傳送與接收者的名稱。 indirect link 則不須指定名稱,只需透過緩衝區 mailbox / port 來收送資料。
(2). unboundded-buffer 與 boundded-buffer : 緩衝區有無長度限制。
6. IPC 為行程間的通訊,Process依關係可以分為: related process (父母與子女)與 unrelated兩種。
7. Linux IPC技術有: shared memory、Pipes FIFO、sockets、mapped memory。
8. 參考shm_allocate.c 中的share memory實作: 依序4個步驟 allocate => attach => detach => deallocate。
9. ipcs指令可以追蹤目前的IPC狀態。
10. shm_read.c編譯執行後會出現Segmentation Fault狀況! (已解決: 須先執行 shm_allocate)
11. mapped memory 與 shared memory 類似,差別在於mapped mempry是使用share file來進行通訊。
12. mapped memory會將共享檔案所分配到的virtual address 分割為以page size為單位大小的空間,使檔案存取變為記憶體式的存取。
13. 完成mmap之後將原先開啟的fd關閉是由於我們已經可以在記憶體中直接操作檔案了。
14. mmap 中的參數 MAP_SHARED為設計IPC機制必須設定的參數。
15. 當程式呼叫到exit會自動作detach的動作。
16. shmdt()只是將virtual address 與 shared memory對應消除,但allocate出來的share memory扔然存在,需再呼叫shmctl()可以完全清掉share memory區段。
17. mmap_write.c編譯執行後會出現Segmentation Fault 的問題。
18. Pipes為一種單向的通訊方式,用於 (1)Process 產生的Thread間的溝通 (2)Parent 與 child Process的溝通。
19. fdopen()為GNU/Linux提供的function call。
20. pipe.c 中parent 與 child 的fd交換號碼之後會出現Segmentation Fault問題(或許pipe(fd)即將fd[0]初始化為寫入檔案描述子,fd[0]為讀取檔案描述子)。
21. Socket是Process間的雙向IPC通訊介面,又分為Internet Domain Sockets 與 UNIX Domain Sockets。
22. UNIX Domain Socket s又稱為local sockets 用於本地端的Process通訊使用。
23. Internet Domain Socket 則用來與遠端主機的process溝通。
24. 以FTP Server 的例子解釋Socket的使用方式: 在server端先啟動server程式,這個程式會等待並接收client 使用者的連線請求,這個等待的動作稱為Accept。而使用者端則須啟動client 程式做連線初始化與server端連線,此動作稱為connect,也可以說socket通訊機制為一個主從式架構的機制。
25. server.c 實驗卡在server ip addr的設定。
26. Practical TCP/IP Sockets in C : http://cs.baylor.edu/~donahoo/practical/CSockets/
27. server端的socket初始化:
28. 思考server端在執行到listen()時系統的行為狀態為何? 是在背後執行的狀態?
沒有留言:
張貼留言