Re:Go-like channels in 10 lines of JavaScript
by grupthink on Saturday February 04, 2023 @06:40PM
(#34659686)
Is that concurrency? The CPU is not switching between tasks; rather, it's scheduling 2 callbacks to fire after a 3000ms delay.
[ Parent
| on HN ]
Re:Go-like channels in 10 lines of JavaScript
by vore on Saturday February 04, 2023 @06:50PM
(#34659785)
Concurrency is not parallelism:
- Concurrency is making overlapping progress on two or more tasks.
- Parallelism is making simultaneous progress on two or more tasks.
Concurrent tasks can run in parallel, but they can also run not in parallel and still make overlapping progress by either cooperative or preemptive scheduling. You can imagine that in some larger tasks you have these 3 second sleeps, but all tasks are able to make overlapping progress without blocking the other ones -- that's concurrency!
Re:Go-like channels in 10 lines of JavaScript
by avinassh on Sunday February 05, 2023 @02:35AM
(#34662777)
There is a great talk by Rob Pike: Concurrency is not Parallelism - https://www.youtube.com/watch?v=oV9rvDllKEg&t=23s