diff --git a/W12D1/WANGYuhao.md b/W12D1/WANGYuhao.md new file mode 100644 index 0000000..0ca4df9 --- /dev/null +++ b/W12D1/WANGYuhao.md @@ -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 更常用。 \ No newline at end of file diff --git a/W12D1/menu.md b/W12D1/menu.md index e69de29..61ca0f0 100644 --- a/W12D1/menu.md +++ b/W12D1/menu.md @@ -0,0 +1 @@ ++ [WANG Yuhao](WANGYuhao.md) \ No newline at end of file diff --git a/W12D1/wyh-1.png b/W12D1/wyh-1.png new file mode 100644 index 0000000..d0b5a82 Binary files /dev/null and b/W12D1/wyh-1.png differ diff --git a/W15D2/WANGYuhao.md b/W15D2/WANGYuhao.md new file mode 100644 index 0000000..cf1dc77 --- /dev/null +++ b/W15D2/WANGYuhao.md @@ -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...) + ++ 在程序运行中设置同步点,只有当所有同步点都被达到后才能继续运行 ++ 要求较为严格,时间花费太大 \ No newline at end of file diff --git a/W15D2/menu.md b/W15D2/menu.md index e69de29..61ca0f0 100644 --- a/W15D2/menu.md +++ b/W15D2/menu.md @@ -0,0 +1 @@ ++ [WANG Yuhao](WANGYuhao.md) \ No newline at end of file diff --git a/W8D2/W8D2-by-wyh.md b/W8D2/W8D2-by-wyh.md new file mode 100644 index 0000000..4aed89c --- /dev/null +++ b/W8D2/W8D2-by-wyh.md @@ -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 问题。 \ No newline at end of file diff --git a/W8D2/menu.md b/W8D2/menu.md index e69de29..a4b3fa8 100644 --- a/W8D2/menu.md +++ b/W8D2/menu.md @@ -0,0 +1 @@ ++ [王俞皓](W8D2-by-wyh.md) \ No newline at end of file