2. • More than 5 years production experience in web development.
• More than 1 year experience in EPAM Systems.
• Experience in pure JavaScript.
• Focus on writing SPA using React and Redux.
• Interest in Algorithms and Computer Science.
S E N I O R S O F T WA R E E N G I N E E R
2
3. GOALS
U N D E R S T A N D H O W N O D E J S W O R K S U N D E R A H O O D
A L L O W S B E T T E R U N D E R S T A N D C O D E
E F F E C T I V E L Y W R I T E B A C K - E N D J A V A S C R I P T H I G H - L O A D A P P L I C A T I O N
3
8. The event loop is what allows Node.js to perform
non-blocking I/O operations — despite the fact that
JavaScript is single-threaded — by offloading
operations to the system kernel whenever possible.
8
48. Second circle: other microtasks queue
48
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
49. Second circle: phase check
49
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
50. Second circle: phase close callbacks
50
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
51. Second circle END
51
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
52. Third circle START: phase timers
52
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
53. Third circle START: phase pending callbacks
53
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
54. Third circle START: phase idle, prepare
54
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
55. Third circle START: phase poll
55
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
56. Third circle START: phase check
56
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
57. Third circle START: phase close callbacks
57
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
58. Third circle END
58
> START
END
Next Tick
Promise
Promise Next Tick
setTimeout 1
setTimeout 2
setImmediate
readFile Next Tick
readFile setImmediate
readFile setTimeout
64. Threadpool can be used to run user code and get
notified in the loop thread.
Its default size is 4, but it can be changed at startup
time by setting the UV_THREADPOOL_SIZE
(process.env.UV_THREADPOOL_SIZE) environment
variable to any value (the absolute maximum is
128).
64