Message from JavaScript discussions

October 2018

— Lets say you have 3 functions... A, B, and C... and they each contain 3 units of work each...

— 

If you were to run them concurrently, and fairly, they would run their work units like so:

A.1, B.1, C.1, A.2, B.2, C.2, A.3, B.3, C.3

— None is running at the same time as another in real time, rather you interlace their execution

— And they can trade control between each other

— 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

Message permanent page

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