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 W11D2/W11D2_ZhongYichao.md
Original file line number Diff line number Diff line change
@@ -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.
55 changes: 55 additions & 0 deletions W3D2/W3D2_ZhongYichao.md
Original file line number Diff line number Diff line change
@@ -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

24 changes: 24 additions & 0 deletions W7D1/W7D1_ZhongYichao.md
Original file line number Diff line number Diff line change
@@ -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