Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions W12D1/WANGYuhao.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## 11.28 notes

### Distributed Computing System

- Example Problem: Snoopy Protocal
- Key: Coherence vs. Consistency

考虑 SMP 架构:多个处理器拥有自己的 Cache,共用一块内存.

#### SMP 架构下的 Coherence 问题:

解决方案:

- snoopy coherence 协议(分布式)(监听)
- Diretory-based(集中式)

考虑 snoopy protocols 方案

1. invalidate

将别处修改过的的数据作废

> 将 valid 位设为 false 即可,不需要改动数据

example: **MESI(Modified Exclusive Shared Invalid) 协议**

![](wyh-1.png)

状态机基于这种方案.

2. broadcast

将数据改成 x' (改动后的数据)

若修改数据,为保证原子性需要等待所有数据修改完,故效率可能不如 invalidate 高,故 invalidate 更常用。
1 change: 1 addition & 0 deletions W12D1/menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+ [WANG Yuhao](WANGYuhao.md)
Binary file added W12D1/wyh-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions W15D2/WANGYuhao.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## 12.21

alei 老师的复习课

### Pipeline Loop

计算 branch prediction 的命中率

### RAID 0-1 vs. RAID 1-0

区别:先组成 RAID 1 和先组成 RAID 0 的区别

### Consistency Model
> contract between Software and Memory

#### with sync

+ strict
+ 上帝时钟

+ sequential
+ 需保持指令的先后执行顺序

+ casual
+ 保证内存层面上因果关系即可

+ Intel TSX
+ 依赖 Cache snoopy 一致性协议

**Example**

```text
P1 W(x)1 W(x)3

P2 R(x)1 W(x)2

P3 R(x)1 R(x)3 R(x)2 not sequential \
|-> but casual consistency
P4 R(x)1 R(x)2 R(x)3 almost strict /
```

#### without sync(i.e. lock...)

+ 在程序运行中设置同步点,只有当所有同步点都被达到后才能继续运行
+ 要求较为严格,时间花费太大
1 change: 1 addition & 0 deletions W15D2/menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+ [WANG Yuhao](WANGYuhao.md)
52 changes: 52 additions & 0 deletions W8D2/W8D2-by-wyh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## 11.2

### Cache (cont'd)

#### Virtual Cache

+ Cache 中使用虚拟地址

+ 地址转换发生在 Cache 和 Memory 之间

#### Physical Cache

+ Cache 中使用物理地址

+ 地址转换发生在 Core 和 Cache 之间

#### Difference

假设正常情况下地址转换延迟与内存访问延迟数量级相同。考虑在一个实例中,地址转换延迟为 100, 内存访问延迟为 100, Cache 访问延迟为 1。

+ Virtual Cache
+ hit: 1
+ miss: 1 + 100 + 100

+ Physical Cache
+ hit: 100 + 1
+ miss: 100 + 1 + 100

而一般来说 miss rate 数值较小,故从时间延迟上来看,Virtual Cache 更优。

但实际上 Virtual 存在以下问题:

+ Synonymous: 同一个虚地址在不同列表内对应不同物理地址;
+ Alias: 多个虚地址指向同一个物理地址,从而引发同步问题。

实际上这两个问题都不难解决。

对于 Synonymous,可以直接在 Cache 中的 tag 中加上进程的信息(PID);

对于 Alias,考虑下图。由于利用 virtual adress 在 Cache 中寻址时会根据 index 定位,那么只需要保证同一个物理地址 index 相同就行(即使需要替换也不会出现多个备份,就不会有不同备份间的 sync 问题)

```plain
virtual address
|<----d--->|
[ page no. | disp ]

cache
|<----t---->|<--i-->|<-b->|
[ tag | index | bs ]
```

通过增加 $d$ (增加 page size)或者减小 $i$ (增加关联度)的方法可以使得 $d\ge i+b$,从而保证不会出现 Alias 问题。
1 change: 1 addition & 0 deletions W8D2/menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+ [王俞皓](W8D2-by-wyh.md)