Re: [理工] [計組] disk delay trapping to OS
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):