Message from JavaScript discussions

October 2018

— This is concurrency

— 

SO each function is partially run, and control is passed to the next which also partially runs, and the functions are re-entered to continue execution by taking turns, until all of the units of work inside each function have completed executing

— Parallelism == make more than one task at the same time?

— Correct

— It means you can take work units from one function, and instead of running them in-order, or sequentially, you run them simultaneously

Message permanent page

— 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

Message permanent page

— "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!