Stanford CS144 Introduction to Computer Networking 学习笔记(二)

来源:互联网 发布:矩阵的阶数是什么 编辑:程序博客网 时间:2024/06/06 02:48

1-5: The Principle of 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 switch(分组交换机): 不需要知道per-flow state,即packet属于哪个flow

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

packet switching有两种方式:(1)self routing(不再使用):packet的header中包含有它从source到destination的路线;(2)forwarding table: a switch can have a table of destination addresses and the next hop

Flow: A collection of datagrams belonging to the same end-to-end communication, e.g. a TCP connection.

好处

packet switch简单

多个flow可以充分利用link的能力(Statistical Multiplexing)

1-6: The Principle of Layering

layer只和上下层的layer交流,下层layer为上层提供了well-defined service,各layer可以随着时间改进而不影响其他层

举例:邮局系统;航空公司;编程

有时为了特殊目的,需要打破layering,比如在c语言中加入assembly code,使得上层和底层的processor不再相互独立。

1-7: The Principle of Encapsulation

这里写图片描述
Encapsulation allows you to layer recursively, 比如TCP segment可以在另一个TCP segment,应用VPN(virtual private network)

Encapsulation is how layering manifests in data representation

  • Help separation of concerns

  • Help enforce boundaries/layering

  • Simplify layer implementations

1-8: Byte order and packet formats

这里写图片描述

这里写图片描述

Internet使用的协议都是big endian,即packet to be in a big endian format

network (byte) order is big endian,网络编程时需要将network order转为host order

文本数据在内存中的layout与字节顺序无关,在big endian和little endian的机器上显示结果相同

0 0
原创粉丝点击