by Keziyah Lewis
Node.js
the stack
single threaded - only one brownie at a time
Sometimes I get brownies that I can't eat right away.
setTimeout
fs.readFile
app.get(/stuff)
crypto.randombytes
I want to keep eating brownies but these async brownies will block me from doing so. I need help!
My brownie helpers!
- workers that help do I/O intensive or CPU intensive stuff
- easy to clone so I can get an many as I need
- literal slaves, no rights
worker pool
event loop
- executes callbacks for asynchronous events
- callbacks are added to event queue, and are added to the stack once it is clear
- total bitch but gets the job done
addEventListener
event loop
web api:
addEventListener
anonymous
1. anonymous
anonymous
getRecipe
fs.readFile
worker pool
fs.readFile
anonymous
1. anonymous
anonymous
setTimeout