SlideShare una empresa de Scribd logo
1 de 21
Node Event Loop
Wants to see if his team member Pam
should get a raiseAlan
Wants to schedule a 2 week vacation
Bob
● Check Pam’s sales figures
● Compare to company performance
● Give her the raiseAlan
● Check available vacation hours
● Schedule his vacation
Bob
IIS
Alan
Bob (Empty)
Jim
Come into my office
IIS
Alan
Bob (Empty)
Jim
I need Pam’s sales figures
IIS
Alan
Bob (Empty)
Jim
Jim logs into sales tracker and looks
up info
IIS
Alan
Bob (Empty)
Jim
few min later
gives answer
IIS
Alan
Bob (Empty)
Jim
How much vacation do I have left?
IIS
Alan
Bob (Empty)
Jim
Jim logs out of sales tracker and into
vacay tracker
IIS
Alan
Bob (Empty)
Jim
few min later
gives answer
IIS
Alan
Bob (Empty)
Jim
Few more rounds of Jim logging in/out. Alan
and Bob wait it out
Alan
Bob
An hour later they’re back at their desks
IIS
oh no, their work has piled up! :(
Threads take up resources
Threads cause context switching
Synchronous operations must wait to
continue working
IIS
Node
Intern 1
Jim
Intern 2
Door slot
Node
Intern 1
Jim
Intern 2
Sales query
from Alan
Node
Intern 1
Jim
Intern 2
Node
Intern 1
Jim
Intern 2
Vacay query
from Bob
Node
Intern 1
Jim
Intern 2
Node
Intern 1
Jim
Intern 2
Answer
Node Jim calls Alan
with the answer
for his query
Meanwhile, Alan has been productive with his
work
Single thread saves RAM and CPU
Queue for incoming I/O requests
Asynchronous ops, your code can keep
working while you wait for a callback
Node

Más contenido relacionado

Destacado

RachelVBelt_DissertationMHHPM_LSTM_reduced size
RachelVBelt_DissertationMHHPM_LSTM_reduced sizeRachelVBelt_DissertationMHHPM_LSTM_reduced size
RachelVBelt_DissertationMHHPM_LSTM_reduced sizeRachel Belt
 
Proteccinjurdicadelsoftware 091228092436-phpapp01
Proteccinjurdicadelsoftware 091228092436-phpapp01Proteccinjurdicadelsoftware 091228092436-phpapp01
Proteccinjurdicadelsoftware 091228092436-phpapp01Neydyk anguiosa
 
клип по сонету шекспира
клип по сонету шекспираклип по сонету шекспира
клип по сонету шекспираЯна Сушкова
 
Looking to sell statistical products on Amazon? Do it in five steps, using th...
Looking to sell statistical products on Amazon? Do it in five steps, using th...Looking to sell statistical products on Amazon? Do it in five steps, using th...
Looking to sell statistical products on Amazon? Do it in five steps, using th...Stats Cosmos
 

Destacado (7)

RachelVBelt_DissertationMHHPM_LSTM_reduced size
RachelVBelt_DissertationMHHPM_LSTM_reduced sizeRachelVBelt_DissertationMHHPM_LSTM_reduced size
RachelVBelt_DissertationMHHPM_LSTM_reduced size
 
Senior Leadership Team Presentation
Senior Leadership Team PresentationSenior Leadership Team Presentation
Senior Leadership Team Presentation
 
Proteccinjurdicadelsoftware 091228092436-phpapp01
Proteccinjurdicadelsoftware 091228092436-phpapp01Proteccinjurdicadelsoftware 091228092436-phpapp01
Proteccinjurdicadelsoftware 091228092436-phpapp01
 
клип по сонету шекспира
клип по сонету шекспираклип по сонету шекспира
клип по сонету шекспира
 
Looking to sell statistical products on Amazon? Do it in five steps, using th...
Looking to sell statistical products on Amazon? Do it in five steps, using th...Looking to sell statistical products on Amazon? Do it in five steps, using th...
Looking to sell statistical products on Amazon? Do it in five steps, using th...
 
Negara berkembang
Negara berkembangNegara berkembang
Negara berkembang
 
Goggi
GoggiGoggi
Goggi
 

Node event loop