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
32 changes: 32 additions & 0 deletions W11D2/note_liu_yiyu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 algorithms.

Object-based middleware "**CORBA**"

Based on CORBA. Distributed systems.
48 changes: 48 additions & 0 deletions W3D2/note_liu_yiyu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Process & Thread

## Sync

### Lock, Mutex and Semaphore

Race condition

Semaphore by Dijkstra

- need a counter
- a waiting queue (either kernel or user)
- maybe two locks (mutex and a flag/slot)
- order (as a stack)

Mutex
```c
pthread_mutex_lock(&mutex);
pthread_cond_wait(&cond, &mutex);
```

The second line is to avoid sleep with a mutex locked and to make it possible for the consumer to wake it.

### Monitor

To design a sync function in language level.

Avoid the problem caused by a breaking change in architecture

### Memory Barrier

To make sure the consistency

- Before this statement, no matter what the order is (for multi-thread), nothing happened.
- After this statement, ...
- But the statements after this statement cannot be executed before the memory barrier. And vice versa.

### Thread Scheduling

For a scheduler, it should determine who is next.

Algorithm:
- RR
- O(1): In O(1) time complexity
- Staircase Down
- RSDL
- CFS
- Brain Fuck
24 changes: 24 additions & 0 deletions W7D2/note_liu_yiyu.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 then 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