Skip to content

Commit

Permalink
vault backup: 2024-11-14 16:51:03
Browse files Browse the repository at this point in the history
  • Loading branch information
zzicarus committed Nov 14, 2024
1 parent 34a4044 commit 11ee13d
Show file tree
Hide file tree
Showing 14 changed files with 1,322 additions and 60 deletions.
41 changes: 34 additions & 7 deletions docs/CS/CA/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@
- Matrix
- Loop Fusion
- Merging Array
-







2. Reduce the miss penalty and miss rate via parallelism
### Reduce the miss penalty and miss rate via parallelism

- Nonblocking Caches
- The cache to continues to supply hits while processing read misses ( **hit under miss , hit under multiple miss** ).

- Hardware Prefetching of Instructions and data
- reduces compulsory misses
-

- Compiler-controlled prefetch
- Binding prefetch
- Non-Binding prefetch
- Binding prefetch
- Non-Binding prefetch


Expand All @@ -85,4 +87,29 @@ Fitting the cache on the chip with the CPU is also very important for fast acces

**pipelined Cache Access**

**Trace Cache**
**Trace Cache**

## Memory

organizing memory to improve bandwidth

- Main memory is usually made from DRAM while caches use SRAM.

### Improving Performance

#### Wider Main Memory

#### simple Interleaved Memory

<img src="https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202410291411064.png" alt="image-20241029141107912" style="zoom:33%;" />

#### Independent Memory Banks

### Memory Tech

- Access time ----- time between when a read is requested and when the desired word arrives
- Cycle time ----- minimum time between requests to memory. One reason that cycle time is greater than access time is that the memory needs the address lines to be stable between accesses.

[内存基础 - HobbitQia的笔记本](https://note.hobbitqia.cc/Logic/logic07/#ram)

如何激活使用激活快捷方式(默认:田+ Shift +@) 屏幕上将显示覆盖区。单击并按住主鼠标按钮,然后拖动以激活捕获。文本将保存到剪贴板。
20 changes: 20 additions & 0 deletions docs/CS/CN/LABS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CN - Labs

> [!abstract] 用于备忘一些实验中的命令/操作
>
> - [计算机网络 Computer Network | 计算机网络课程实验文档 (zjucomp.net)](https://zjucomp.net/)
## 实验一:wireshark抓包

## 实验二:两层交换机

## 实验三:三层交换机

**实验环境配置**

[功能与设备使用介绍 | 计算机网络课程实验文档 (zjucomp.net)](https://zjucomp.net/docs/GNS3/client-usage)

- 退出时可能会消除之前的所有配置,需要手动保存。请确保已经通过设备内的 write 命令保存过配置

## 实验七:Socket编程

136 changes: 127 additions & 9 deletions docs/CS/CN/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ update: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
>[!note] 传输层协议
TCP 面向连接的
UDP
UDP
MAC 唯一的,基于网卡的

>[!info] Four Internet Model
Expand Down Expand Up @@ -74,45 +74,163 @@ MAC 唯一的,基于网卡的
- Service
- Interface
- Protocol



**各层级的作用**

- Physical Layer 物理层并不是物理介质,不包括电缆线等这些介质。规定了一些电路接口、信号
- Network Layer
传输单位为 ``。
传输单位为 `packet`
- Data Link Layer
将来自网络层的 IP 分组封装成 **frame**,可靠地传输到相邻结点的网络层。可以将强物理层传输原始比特流的功能,将物理层可能出错的错误进行修正

>The data link layer operates between two directly connected nodes and does not provide end-to-end communication。
IP Service
### **IP Service**

> [!note]
>
> ![image-20241028152518801](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202410291100041.png)
**simple service**

- Datagram
- Unreliable
- Best Effort
- 只有在出错的时候才会直接丢掉

- Connectionless

> [!note] Why Ip So Simple
>
> - Simple, dumb, minimal, faster
> - End - to - end principle
> - done by software
> - more top layer choice
> - udp tcp
> - work at any link layer
> - 泛用性
**features**

- End-to-end
- 阻止 packets 永远 loop
- TTL
- TTL
- Fragment packet
- 链路层的带宽一定
- Header提供信息帮助Fragment
- Header to checksum
- 可拓展,增加新的 options 到 header
- Version
- IPv4 32bits
- IPv6 128bits

**IPV4**
![image.png](http://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202409241207369.png)

- Version: IPV 4/6
- Total Packer Length :Header and data
- Type Of service: how important
- Total Packer Length :Header and data | MAX = 64KB
- Type Of service: how important is the packet
- Packet ID
- Flags
- Flags | 帮助分段
- Fragment Offset
- Protocol ID:说明 data 是哪种类型,将 data 交给相应的 code 进行处理。( == 6 )
- Protocol ID:说明 data 是哪种类型,将 data 交给相应的 code 进行处理。( == 6 )
- TTL

采用 three-way handshake 方法

- SYN (Synch)
- SYN / ACK
- ACK

**TCP**

Forwarding table
Forwarding table

- `traceroute` Linux
[traceroute使用与实现原理分析 - 知乎 (zhihu.com)](https://zhuanlan.zhihu.com/p/36811672)
-

#### Principle

1. **Packet Switching**

- 在中间的Router使用Switching Table
- Simple packet forwarding
- 交换机不需要任何关于flow的信息,可以处理independent packet
- Efficient sharing of links

**Data traffic is bursty**

-

2. **Layering**

3. **Encapsulation**

> [!note] Big endian/ Little Endian
>
> > 在不同的架构主机采用的大小端不同,但是网络层统一为大端,网络编程提供了一些helper function帮助转化
>
> 网络顺序和主机顺序的转换
>
> - `htons()`
> [!note] IPv4
>
> **Netmask 网络掩码**:用于判断是否在同一个
>
> 网络掩码(Netmask)又称[子网掩码](https://baike.so.com/doc/4236543-4438579.html) 用于从[IP地址](https://baike.so.com/doc/4252723-4455111.html)中提取网络号或[主机](https://baike.so.com/doc/5331327-5566564.html)号。网络掩码就是结构为[网络号](https://baike.so.com/doc/2026144-2143986.html)全部是1,主机号全部是0的IP地址。
>
> - 如果在一个子网下,转发信息不通过router
> [!note] LPM | Longest Prefix Match
>
> 路由表中的每个表项都指定了一个网络,所以一个目的地址可能与多个表项匹配。最明确的一个表项——即[子网掩码](https://zh.wikipedia.org/wiki/子网掩码)最长的一个——就叫做最长前缀匹配。
>
> 之所以这样称呼它,是因为这个表项也是路由表中,与目的地址的高位匹配得最多的表项。
>
> > **网络前缀越长,其地址块就越小,意味着路由就越具体(more specific)越准确**
> [!note] Address Resolution Protocol | ARP
>
> **地址解析协议:**在局域网中将IP地址映射到物理地址(MAC地址)的网络协议。ARP的主要作用是在同一网络中,设备通过已知的IP地址来获取目标设备的MAC地址,以便进行数据包的传输。
>
> ![image-20241028170616900](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202410281706074.png)
>
> - Hardware:1(Ethernet)
> - protocol:0x0800(IP)
> - protocol address:IP地址
> - opcode:Request/Response
>
> > [!example] - 例子
> >
> > #### 步骤:
> >
> > 1. **ARP请求**
> > - 主机A生成ARP请求,内容为:
> > - 源IP:`192.168.1.2`
> > - 源MAC:`AA:BB:CC:DD:EE:FF`
> > - 目标IP:`192.168.1.3`
> > - 目标MAC:`00:00:00:00:00:00`(未知)
> > - 主机A将该请求广播到局域网。
> > 2. **ARP响应**
> > - 主机B接收到ARP请求,发现目标IP匹配自己的IP地址,于是发送ARP响应,内容为:
> > - 源IP:`192.168.1.3`
> > - 源MAC:`FF:EE:DD:CC:BB:AA`
> > - 目标IP:`192.168.1.2`
> > - 目标MAC:`AA:BB:CC:DD:EE:FF`
> > - 主机B将ARP响应单播回主机A。
> > 3. **缓存更新**
> > - 主机A收到ARP响应后,将`192.168.1.3`和对应的MAC地址`FF:EE:DD:CC:BB:AA`存储在ARP缓存中,以便下次直接使用。


![](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202410281523829.png)



**What is Internet layer**

## Internet
8 changes: 4 additions & 4 deletions docs/CS/CN/Physical Layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ update: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
- **反向非归零编码 NRZ Insert (NRZI)**:信号翻转代表 1,不翻转代表 0
- **曼彻斯特编码 Manchester**: 将码元分割成两个相等的间隔,下跳表示 1,上跳表示 0. 电平跳变既是时钟信号用于同步,又是数据信号
- 以太网使用
- **差分曼彻斯特编码**:电平跳变仅仅表示时钟信号,码元开始处无跳变为 0 有则为 1
![image.png](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202409261002264.png)
- **差分曼彻斯特编码**:电平跳变仅仅表示时钟信号,码元开始处无跳变为 1 有则为 0
![image.png](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202409261002264.png)

- 调制:数据 -> 模拟信号 module
- FM 应用广泛
- PM 改变载波的相位来表示 1/0,用相位 $0/pai$ 表示——绝对调相
- QAM 正交幅度调制 :在频率相同的条件下,结合 AM、PM
![image.png](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202409261020490.png)
![image.png](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202409261020490.png)
- 多路复用 multiplexing
-

Expand Down Expand Up @@ -78,7 +78,7 @@ update: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>

- 按时间分时

### Code Division Multiplexing
### Code Division Multiplexing | CDM | CDMA

- 码分,更加灵活可以灵活调整带宽的分配
- 同频又同时,同时发出但存在规律可以反解码
Expand Down
6 changes: 6 additions & 0 deletions docs/CS/CN/cs144.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ Packet Switching
- Statical Multiplexing
- 允许 flows 使用所有的 link capacity
- 允许 flows share link capacity



![image-20241028151818682](https://zzh-pic-for-self.oss-cn-hangzhou.aliyuncs.com/img/202410281518970.png)

- TCP保证可靠的数据传输
Loading

0 comments on commit 11ee13d

Please sign in to comment.