Multi-Programming
Concurrency and Parallelism.
tl;dr
concurrency - dealing with many things at once parallelism - doing many things at once
Threads:
- 1:1 -- (kernel-level) each user thread corresponds to a kernel thread
- N:1 (user-level) all user threads correspond to a single kernel thread
- M:N (hybrid)
IMPLEMENATIONS
C++
TODO
Java
Every java object has its own lock
new Thread(() -> {
//
}).start();
Go
Lighter weight than threads. Goroutines get multiplexed onto OS threads as needed.
Channels are like unix pipes but they have names and types.
select allows you to listen to channels. Like a switch statement.
Javascript
TODO
RESOURCES
Coordinated Concurrency: Reactive (Observables) vs. CSP. Kyle Simpson. JSLA.
Bell Labs and CSP Threads. Russ Cox.
Higher-level threading interface. The Python Standard Library.
Chapter 17. Threads and Locks. The Java Language Specification. Oracle.
What is the difference between concurrency and parallelism?. Quora.
Concurrency model and Event Loop. Mozilla Developer Network.
Concurrency Is Not Parallelism. Rob Pike.