Message from JavaScript discussions

October 2018

— It can rapidly switch between stacks, and partially run the current function in each, but only 1 at a time can be in active execution

Message permanent page


When you add multithreading from NapaJS, you then can use that technique on multiple CPU cores instead of only 1

— Concurrency is not parallelism, but it allows it to happen

— Ok. So which os the.diferrent between concurrency and promises?

— A promise is a type of control flow construct for chaining continuations, concurrency is a fundamental computer science theory

Message permanent page

— 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

Message permanent page

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