Concurrency, Parallelism and Scheduling in JavaScript
summary
JavaScript remains single‑threaded but the runtime enables concurrency via the event loop and microtasks (promises, process.nextTick), plus parallelism through web workers (browser) and experimental worker threads in Node 10. Demo code shows a ping‑pong message loop between main thread and a worker, CSP‑style channels implemented with message/putter/taker queues and promises, a Select/peek race avoiding lost messages, and a note that setTimeout callbacks have a ~4.7ms minimum.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 0:46About the speaker
- 1:50Short history of JavaScript
- 3:59Scheduling models
- 5:46Parallelism types
- 6:27Concurrency models
- 8:37JavaScript basics
- 9:42Event loop explained
- 11:52Node.js event loop
- 13:19Blocking the event loop
- 14:44Callbacks and issues
- 16:07Promises introduction
- 17:52Generators in JavaScript
- 19:14Async/await explained
- 20:20Observables overview
- 21:44Naive threading approach
- 22:48Actors model
- 25:38Web Workers basics
- 27:47Web Workers limitations
- 29:14Go model CSP
- 30:18Implementing channels
- 31:42CSP ping-pong demo
- 34:59Select operator in JavaScript
- 37:29Q&A session
