📜  分组交换中的流水线

📅  最后修改于: 2021-09-28 10:26:08             🧑  作者: Mango

分组交换:
一种数据传输模式,在该模式中,消息被分成多个独立发送的部分,通过每个数据包的最佳路由,并在目的地重新组合。分组交换在交换分组时使用存储和转发技术;在转发数据包时,每跳首先存储该数据包然后转发。

众所周知,数据被分成许多小包以减少总延迟。所以你怎么看?数据包数量越大,延迟越小?
不,实际上这不是真的。好的,让我们通过例子来理解。

例子:

Given,

Data size = 1000 Bytes
Bandwidth = 1 MBps
Header size = 100 Bytes
Number of Hops = 3
assume Propagation dalay = 0

说明:以下是不同的场景。

案例 1:如果数据包数 = 1

Size of the Data Packet, 
= Data size + Header size 
= 1000 + 100 = 1100 Bytes

Transmission delay 
= L/BW = 1100/10^6 = 1.1 ms 

Total time taken 
= number of Hopes * Transmission delay 
= 3 * 1.1 = 3.3 ms 

案例 2:如果数据包数 = 5

Size of each Data Packet 
= (1000/5) + 100 = 300 Bytes

Transmission Delay for each Packet 
= 300/10^6 = 0.3 ms 

Time taken by 1st Packet, 
= No of Hops * Transmission delay 
= 3*0.3 = 0.9 ms

Time taken by the remaining 4 Packets 
= 4*Transmission delay 
= 4*0.3 = 1.2 ms

Total Time Taken, 
= 0.9+1.2 = 2.1 ms 

案例 3:如果数据包数 = 10

Size of each Data Packet 
= (1000/10) + 100 = 200 Bytes

Transmission delay for each packet  
= 200/10^6 = 0.2 ms

Time Taken by first Packet 
= 3*0.2 = 0.6 ms

Time Taken by remaining Packets 
= 9*0.2 = 1.8ms

Total Time Taken 
= 0.6+1.8 = 2.4 ms 

案例 4:如果数据包数 = 20

Size of each Data Packet 
= (1000/20) + 100 = 150 Bytes

Transmission delay for each Packet 
= 150/10^6 = 0.15 ms

Time Taken by 1st Packet 
= 3*0.15 = 0.45 ms

Time Taken by remaining 19 Packets 
= 19*0.15 = 2.85 ms

Total Time Taken 
= 0.45 + 2.85 = 3.3 ms 

正如我们所看到的,存在一个总时间减少的阈值,如果我们在该限制之后增加数据包数量,总时间开始增加。最初时间会减少一些限制,之后时间会增加。如果数据包的数量非常大,那么它所花费的时间可能比传输单个数据包所花费的时间更长。