diff --git a/W11D2/W11D2_ZhongYichao.md b/W11D2/W11D2_ZhongYichao.md new file mode 100644 index 0000000..7c3ff6a --- /dev/null +++ b/W11D2/W11D2_ZhongYichao.md @@ -0,0 +1,35 @@ +## MULTI-core/processor/computer + +SMC/SMP/cluster/Grid/Cloud... + +multi: shared memory, multi-CPU + +UMA-NUMA + +multiple spinlock, bus + +- Avoid cache thrashing! + +- Time sharing, the art of scheduling + +"Gang scheduling" : A gang of related threads are scheduled as a unit, a "gang" + +"Computational Graph": ->"A platform for ML" + +"Distributed Shared Memory": Like page table, with indices + + + +#### Graph computing + +relations between Nodes, allocation of resources,... + +GraphChi + +Speed up executing, space less, locality is good. + +And we have alogorithms. + +Object-based middleware "**CORBA**" + +Based on CORBA. Distributed systems. \ No newline at end of file diff --git a/W3D2/W3D2_ZhongYichao.md b/W3D2/W3D2_ZhongYichao.md new file mode 100644 index 0000000..6a148b6 --- /dev/null +++ b/W3D2/W3D2_ZhongYichao.md @@ -0,0 +1,55 @@ +# W3D2 notes + +Edit by: Yichao Zhong + +## Process & threads + +### how to synchronize? + +- lock, mutex, semaphore + - mutex means: mutual exclusion. + - method 1: lock variable. if lock=0, lock=1 and run; if lock =1,wait til lock=0and then run. + - method 2: **Peterson.** Always try to let others run. Run when all else quit the competition. + +- CLI/busywaiting/sleepwakeup + +#### Producer-Consumer problem + +using semaphore. + +```cpp +void producer(void){ +while(1){ + //... + down(&empty) + down(&mutex) + //... + //order cannot be reversed! + up(&mutex) + up(&full) +} + +} +``` + +Monitor: solve the problem at language level. There will be only one procedure running at a time. + +### process scheduling + +#### Memory consistency + +**memory barriers:** to protect the code sequences, which might be edit by compiler, tomasulo, etc.. + +> A barrier is: Cannot change two code if one is before-barrier and the other is after-barrier. + +#### CPU scheduling + +- Q: who's next?! + - according to priority. +- Avoiding locks + - Read-copy-update + +**Scheduling methods:** + +Run Queue(round robin). time-slice as a unit. Tradeoff: context switch + diff --git a/W7D1/W7D1_ZhongYichao.md b/W7D1/W7D1_ZhongYichao.md new file mode 100644 index 0000000..b9138f0 --- /dev/null +++ b/W7D1/W7D1_ZhongYichao.md @@ -0,0 +1,24 @@ +# Dead Lock + +## Conditions + +1. Mutual exclusion +1. Hold and wait +1. No preemption +1. Circular wait condition + +## Solution + +- Don't care! +- Detection and recovery. Let deadlocks occur, detect them, and take action. +- Dynamic avoidance by careful resource allocation. +- Prevention, by structurally negating one of the four required conditions. + +### Detection + +Banker's algorithm + +### Avoiding + +- Resource Trajectories +- In numeric order