通过网络电缆计算数据包的时间

时间:2012-12-05 15:26:36

标签: math networking distance data-transfer

我正准备参加网络考试。

在之前的一次考试中,提出了这个问题:

Assume you're sending a packet of length 4000 bit
through a cable of length 1000 km.
The signal in the cable is moving at 200000 km/s.
The signal bandwidth is 10 Mbit/s.
Calculate how much time it would take for the packet to arrive.

如果我想用汽车做这件事,考虑道路长度和车速, 它可能需要200秒。虽然我不确定如何在计算中应用mbit / s和位。

这是一种正确的做法吗?

(10 mbit/s / 4000 bit) * (200000 km/s / 1000 km) = seconds packet needs to arrive

1 个答案:

答案 0 :(得分:1)

转移时间等于SEND_TIME + EXPANSION_TIME

(为简单起见我使用Mbit为10 ^ 6位而不是2 ^ 20,原理保持不变)

SEND_TIME = #bits / #bits_per_sec = 4000 / 10*10^6 = 4*10^-4
EXPANSION_TIME = length / expansion_speed = 1000 / 200000 = 5 * 10^-3

总计则为0.0054


<强>加成:

一个好的做法是查看单位并确保在最后找到正确的单位,所以上面实际上是:

SEND_TIME = #bits / #bits_per_sec = 4000[bit] / 10*10^6[bit/sec] = 4*10^-4 [bit/bit * sec] = 0.0004 [sec]
EXPANSION_TIME = length / speed = 1000 [km] / 200000 [km/sec] = 5 * 10^-3 [km / km * sec] = 0.005 [sec]