1. Threads
Thread = "thread of execution"
1.1 Why threads?
Express Concurrency
- IO concurrency
- Multicore parallelism
- Convenience
1.2 Thread Challenges
- Race Conditions
- Prevention
- Avoid sharing → Using channel
- Use locks
- Go has a race detector
- Coordination
- Deadlocks
<aside>
💡 Go’s two plans
- No sharing memory → Use channels
- Shared memory → Use locks + condition variables
</aside>
2. Remote Procudure Call, RPC
Goal: $\text{RPC} \approx \text{PC}$
client app handler fns
stub fns dispatcher
RPC lib RPC lib
net ------------ net
2.1 Semantics Under Failures
- at-least-once
- the client will automatically retry