Re: [理工] [計組] disk delay trapping to OS

看板Grad-ProbAsk作者 (麥子)時間13年前 (2011/07/22 23:47), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《mqazz1 (無法顯示)》之銘言: : in order to perform a disk or network access, it is typically necessary for : the user to have the OS communicate with the disk or network controllers. : suppose that in a particular 5 GHz computer, it takes 10,000 cycles to trap to : the OS, 20 ms for the OS to perform a disk access, and 25us for the OS to : perform a network access. in a disk access, what percentage of the delay time : is spent in trapping to the OS? how about in a network access? : ========================= : disk access total time: 10,000/500,000,000 s + 20ms = 20.002 ms : % delay trapping to OS: 0.01% : network access total time: 10,000/5,000,000,000s + 25us = 27us : % delay trapping to OS: 7.4% 先計算 trapping to OS 要的時間 = trapping to OS 需要的 cycle 數 * 一個 cycle 所花的時間 = 10 ^ 4 * 1 / (5 * 10 ^ 9) 10,000 個 cycle * 5GHz 的倒數 = 10 ^ 4 / (5 * 10 ^ 9) = 0.2 * 10 ^ -5 (s) 再計算佔 disk access total time 與 network access total time 的比例 disk: 0.2 * 10^-5 s / 20.002ms = 0.2 * 10^-2 ms / 20.002ms = 0.002 / 20.002 = 0.001 / 10.001 ~= 0.001 / 10 = 0.0001 = 0.01% network: 0.2 * 10^-5s / 27us = 0.2 * 10^-2 ms / 0.027ms = 0.002 / 0.027 ~= 0.074 ~= 7.4% : 請問黃字是怎麼算出來的? : 張凡337頁 : 謝謝 -- 我實實在在的告訴你們,一粒麥子不落在地裡死了, 仍舊是一粒,若是死了,就結出許多子粒來。 約翰福音 12:24 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.116.24.61
文章代碼(AID): #1EAPkgMM (Grad-ProbAsk)
文章代碼(AID): #1EAPkgMM (Grad-ProbAsk)