> For the complete documentation index, see [llms.txt](https://chenyuxiang0425.gitbook.io/cs-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chenyuxiang0425.gitbook.io/cs-notebook/cs144/section1/cs144_1.5.md).

# 1.5 Principle: Packet Switching

Packet switching is the idea that we break our data up into discrete(离散的), self-contained(自包含的) chunks of data. Each chunk, called a packet, carries sufficient information that a network can deliver the packet to its destination.

packet: 一种自包含(self-contained)的数据单位，它携带到达目的地所必需的信息。

Packet switching :对于每个到达的 packet，选择它的 outgoing link。如果 link 是 free 的则发送它。否则 hold the packet for later。

src----A----B----C----dest

| DATA | des |  C  |  B  |  A  |
| :--: | :-: | :-: | :-: | :-: |

## 两个好处

1. Simple packet forwarding.（不需要跟踪packet至destination）
2. Efficient sharing of links.（AB 两个人，A 下东西 B 没下，A 可以得到 full speed of  links，AB 都在下，AB 分享 links）

### 不需要每个流状态（No per-flow state required)

流: 属于同一端到端通信的数据报的集合。例如：一个TCP连接。\
（ Flow:A collection of datagrams belonging to the same end-to-end communication,e.g.a TCP connection.）\
包交换机不需要每个流的状态——每个包都是自包含的。\
Packet switches don't need state for each flow-each packet is self-contained.\
没有要添加/删除的每个流状态\
No per-flow state to be added /removed\
没有要存储的每个流状态\
No per-flow state to be stored\
发送故障，不需要更改每个流的状态\
No per-flow state to be changed upon failure

而对应的在电话网络中应用的circuit switching，其switch是需要维护发送方-接收方connection state，并且为每个发送方-接收方维护一条连接链路

### Efficient sharing of links

* Data traffic is bursty ( 突发式数据的；集送数据的；脉冲数据的 ) &#x20;
  * Packet switching allows flows to use all available link  capacity &#x20;

    (Packet switching 允许流使用所有可用的链路容量。)
  * Packet switching allows flows to share link capacity. &#x20;

    （Packet switching 允许流共享链路容量。）

This is called Statistical Multiplexing\
（这叫做统计多路复用）

## 总结

1. **Packet switches are simple**: they forward packets  independently, and don't need to know about flows. &#x20;

   它们独立地转发包，不需要知道流。
2. **Packet switching is efficient**: It lets us efficiently share  the capacity among many flows sharing link. &#x20;

   它使我们能够在多个流共享链路之间有效地共享容量。
