Message from JavaScript discussions

October 2018

— You may essentially execute all of the work units of a function at the same time, and if you have 3 work units, and 3 CPU cores, the function completes execution as if it were only 1 work unit, providing none of the work units rely on each other to get some data

Message permanent page

— 

If a work unit relies on another work unit to get data, it must wait for that work unit to furnish that data before execution can continue, so there are some points where parallel computations cannot happen

— "work unit" is just a very generic term for "computation"

— 2 + 2 is a unit of work

— I'm learning about bitcoin and needs to learn about concurrency, parallelism and multi-thread

— This can all run in parallel, or at the same exact time:

2 + 2
100 + 100

but this can not run at the same time... the bottom addition must wait for the top addition to finish first:
var number = 2 + 2
number + 100

Message permanent page

— Great!

— I hope I explained well :)

— Yes I understand it. Thanks

— Soon I will be also implementing Golang-like channels for JS... it will be crazy to see this in JS

const myChannel = new Channel("string");
spawn function() { myChannel <- "Hello!" };
console.log(<-myChannel);

Message permanent page

— You can't tell how powerful this is... by just looking at this basic example

— But essentially, the function after spawn runs concurrently