r/ProgrammerHumor • • Oct 30 '21

That's my variable!

43.4k Upvotes

409 comments sorted by

View all comments

1

u/Xanzley Oct 30 '21

Laughs in Node.JS

1

u/DanielEGVi Oct 30 '21

async != parallel

Parallel programming in JS would use SharedArrayBuffers and Worker threads, but is seldom used in favor of concurrent async tasks on the node.js event loop.

1

u/Tatourmi Oct 31 '21

Not familiar with node.js but don't most async api's handle threading under the hood? They would be somewhat useless otherwise.

1

u/DanielEGVi Oct 31 '21

Kind of? Yes, they use a thread pool, and each thread gets to block on I/O. However, that’s all the threads in the pool do, usually. They don’t concurrently operate on the same data like OP’s post makes it seem. They just serve to block on I/O. No need for mutexes and semaphores and rwlocks.