[OS] 單班 project 1 我問助教的一些回答

看板b98902HW作者 (小銘)時間12年前 (2011/10/29 23:17), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串1/3 (看更多)
1.client APPROACH SIZE 敘述是否有錯誤呢? APPROACH: The approach using in the client to send messages. 0 Use “sendmsg()” to send messages. 1 Use “sendmmsg()” to send messages. SIZE: If APPROACH is set to 1, it is the number of times of invocation for “sendmsg()”. Otherwise, it is the batch size of “sendmmsg()”, where the batch size is the third argument, vlen, of sendmmsg() and the description of this argument can be found at http://vacationhomexchg.com/lists/linux-man/msg02117.html. Also, the maximum size is 2000. 在SIZE 這個地方的敘述,當APPROACH為1的時候是用sendmmsg,那SIZE怎麼會是指定 sendmsg的次數呢? 感覺這個敘述應該是反過來? 是, 不好意思當初這邊設計本來是 1 & 2 所以在修改上有些細節沒注意到, 不過意思就如你所想, 若 APPRAOCH 設為 0 則代表sendmsg 送的次數, 反之則為 sendmmsg 的參數 p.s.課程網頁上已改 2.關於recvmmsg的 vlen長度設定: recvmmsg 的函式參數如下: int recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags, struct timespec *timeout); 第三項是vlen ,就我的理解是batch size , 意即要call幾次 recvmsg , 而因為server並不會知道client送msg送了幾份,所以這邊我是用BSIZE(=2048)當作參數 但是這樣的話它就真會call recvmsg 2048次,它並不會看說client 只傳了3次就只call 3次,但這樣就不符合project 1的要求(至少output並不一樣),而我有看過recvmsg和 recvmmsg的函式描述,還是找不到相關的解決辦法說,所以想問這個問題要怎麼解決 http://rswiki.csie.org/phpbb/viewtopic.php?f=19&t=316 不知道您嘗試過論壇上的方法了嗎? server 一般而言是透過回傳值來判斷收的幾份, 所以你可以觀察你的 receive 2048 次, 是否只有 send 的那幾筆資料, 剩下都為 null. 沒錯的話是要改 socket.c 把某兩個 error <0 改成 error<=0 (已經測試成功 但會預期次數多1... ) 3.關於要繳交的檔案,要求是這麼寫的: ‧Upload your source codes and executable file, including Makefile, *.c, *.h, to FTP server ‧Please put all files in a compressed file named ID_REV#.suffix, e.g R98922177_0.zip for first upload. 我想問的是,因為我是直接去改Linux source code裡面的一些檔案(recompile的方法) ,就如助教投影片裡面的方法,會改到 unistd_32.h、syscall_table_32.S、syscalls.h 、Makefile,這樣是我要把這些檔案連著server.c client.c myservice.c的檔案都一併 壓縮然後上傳嗎?? 需要寫一個Makefile 去讓他可以執行嗎?? 要的話有辦法知道linux kernel source 的 資料夾在哪? 是的, 基本上你有修改到的檔案都要包進來~ kernel 部份就附你有修改過得即可. ========================================================================== 以上的內容有做修改,並非完全原本的信寄件內容 希望有幫到大家 噢另外其實以後有問題感覺問助教會快一些,大概都一天內會回吧 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.251.126 ※ 編輯: barry800414 來自: 140.112.251.126 (10/29 23:18) ※ 編輯: barry800414 來自: 140.112.251.126 (10/29 23:23) ※ 編輯: barry800414 來自: 140.112.251.126 (10/29 23:26)

10/29 23:57, , 1F
原來有人跟我一樣有第二個問題...我也是多一次QQ
10/29 23:57, 1F

10/30 12:48, , 2F
推推^^
10/30 12:48, 2F

10/30 12:56, , 3F
推!
10/30 12:56, 3F
文章代碼(AID): #1Eh1Zpht (b98902HW)
文章代碼(AID): #1Eh1Zpht (b98902HW)