gpt4 book ai didi

algorithm - 关于利特尔定律的问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:15:48 24 4
gpt4 key购买 nike

我知道Little's Law状态(释义):

the average number of things in a system is the product of the average rate at which things leave the system and the average time each one spends in the system, or:

n=x*(r+z);
x-throughput
r-response time
z-think time
r+z - average response time

现在我对programming pearls的一个问题有疑问:

Suppose that system makes 100 disk accesses to process a transaction (although some systems require fewer, some systems will require several hundred disk access per transaction). How many transactions per hour per disk can the system handle? Assumption: disk access takes 20 milliseconds.

这里是这个问题的解决方案

Ignoring slowdown due to queuing, 20 milliseconds (of the seek time) per disk operation gives 2 seconds per transaction or 1800 transactions per hour

我很困惑,因为我不明白这个问题的解决方案请帮忙

最佳答案

如果您忘记该公式并认为您可以做某事的速度与您做某事所需的时间成反比,那将更加直观。例如,如果您吃一个比萨饼需要 0.5 小时,那么您将以每小时 2 个比萨饼的速度吃比萨饼,因为 1/0.5 = 2。

在这种情况下,速率是每次交易的数量,时间是交易花费的时间。根据问题,一个事务需要100次磁盘访问,每次磁盘访问需要20毫秒。因此每笔交易总共需要 2 秒。速率为每秒 1/2 = 0.5 个事务。

现在,更正式地说:

每秒交易率 R 与以秒为单位的交易时间 TT 成反比。

R = 1/TT

本例交易时间TT为:

TT = disk access time * number of disk accesses per transaction =
20 milliseconds * 100 = 2000 milliseconds = 2 seconds

R = 1/2 transactions per second 
= 3600/2 transactions per hour
= 1800 transactions per hour

关于algorithm - 关于利特尔定律的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2990315/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com