SlideShare a Scribd company logo
JS Event Loop
BY SAAI VIGNESH P
Agenda
‱ Before getting on to the main topic, we’ve
to re-iterate on:
‱ What is JavaScript?
‱ JS Runtime Environment
‱ Synchrony and Asynchrony
‱ Event Loop
‱ What is Event Loop?
‱ How it works?
‱ Why do we need it?
‱ Code Example Demonstration
What is JavaScript?
‱ JavaScript is a lightweight, cross-platform, and interpreted scripting language. It is used
for web development, both client-side and server-side.
‱ It is based on the ECMAScript Specification (ECMA-262 standard).
‱ The language is:
‱ Single Threaded (Synchronous)
‱ Event-driven (events are emitted and handled)
‱ Imperative (explicit instructions)
‱ Functional (creating and using functions)
JS Runtime Environment
‱ The JavaScript runtime environment provides access to built-in libraries and objects that
are available to a program so that it can interact with the outside world and make the code
work.
‱ The environment consists of:
‱ Execution Engine (Google V8)
‱ Web API – Browser; Low Level API – Node.js
‱ Callback Queue
‱ Event Loop
Synchrony and Asynchrony
Synchronous Calls:
‱ Code executes in the order they are called.
‱ The previous operation/function call should be
completed or done for the control to get transferred.
‱ i.e., they are blocking.
‱ Guess the output !
Output:
I’m Function 1
I’m Function 2
I’m Function 3
Explanation
Call Stack
Explanation
Call Stack
fun1()
Explanation
Call Stack
fun1()
Explanation
Call Stack
fun1()
console.log(“I’m Function 1”)
Output: I’m Function1
Explanation
Call Stack
fun1()
fun2()
Output: I’m Function1
Explanation
Call Stack
fun1()
fun2()
Output: I’m Function1
Explanation
Call Stack
fun1()
console.log(“I’m Function 2”)
fun2()
Output: I’m Function1
I’m Function 2
Explanation
Call Stack
fun1()
fun2()
fun3()
Output: I’m Function1
I’m Function 2
Explanation
Call Stack
fun1()
fun2()
fun3()
Output: I’m Function1
I’m Function 2
Explanation
Call Stack
fun1()
fun2()
fun3()
console.log(“I’m Function 3”)
Output: I’m Function1
I’m Function 2
I’m Function 3
Explanation
Call Stack
fun1()
fun2()
fun3()
Output: I’m Function1
I’m Function 2
I’m Function 3
Explanation
Call Stack
fun1()
fun2()
Output: I’m Function1
I’m Function 2
I’m Function 3
Explanation
Call Stack
fun1()
Output: I’m Function1
I’m Function 2
I’m Function 3
Explanation
Call Stack
Output: I’m Function1
I’m Function 2
I’m Function 3
Blocking Call Example
‱ Imagine downloading a 10 MB image from Internet with JavaScript, with an internet speed
of 1 MB/sec in a browser.
‱ It would ideally take 10 seconds to load the image.
‱ For these 10 seconds, no other operations can be done including rendering.
‱ Once download completes, rest of the operations can be executed.
‱ This is called a synchronous/blocking call.
‱ Solution: Async calls!
Synchrony and Asynchrony
Asynchronous Calls:
‱ Code executes and the control is returned no matter
whether the operation is completed or not.
‱ i.e., they are non-blocking.
‱ But how to know that they are complete? Use
callbacks!
Output:
Hello World
I’m JavaScript
Timeout!
Callbacks? What are they?
‱ A callback is a function passed into another function as an argument, which is then
invoked inside the function to complete some kind of routine or action.
‱ They are usually used with asynchronous operations. eg: background operations.
‱ Example:
setTimeout() and setInterval() works asynchronously.
Background Ops?
SOUNDS GOOD
 BUT HOW??
Cause JavaScript is:
‱ Single Threaded, which means it has only one Call
Stack!!
One more confusion

If JavaScript is Single Threaded,
Then how setTimeout() / setInterval() works?
Here’s where,
We’ve to know some facts

Timer Functions & I/O
‱ JavaScript – No native asynchrony
‱ JavaScript does not have support for Timer and I/O, they’re not part of the language
(ECMAScript specification).
‱ Timer functions such as:
‱ setTimeout()
‱ setInterval()
‱ Input/output functions such as:
‱ console.log()
‱ console.error()
‱ Which means they are implemented by someone else.
‱ Who? It’s the runtime environment (Browser (Web API) / Node.js).
Remember this diagram?
JavaScript
Event Loop
‱ The event loop is a programming construct
or design pattern that waits for and
dispatches events or messages in a
program.
Source: Wikipedia
‱ It is by which the JavaScript language
behaves like a multi-threaded, being
single-threaded by nature.
‱ It is a form of concurrency achieved to
support asynchronous calls in JavaScript.
‱ So how it works? Let’s see

JS Event Loop
Coding to demonstrate Event Loop
Try guessing the output?
Coding to demonstrate Event Loop
Try guessing the output?
Hello World
I’m JavaScript
Timeout!
Output:
Coding to demonstrate Event Loop
Try guessing the output?
Hello World
I’m JavaScript
Timeout!
Output: Hello World
I’m JavaScript
Timeout!
Output:
Let’s see how,
THAT STUFF HAPPENS

Call Stack
Callback Queue
Event
Loop
Web API
Let’s take the example:
Start Execution!
Call Stack
Callback Queue
Event
Loop
Web API
Let’s take the example:
console.log(“Hello World”)
Executing

Call Stack
Callback Queue
Event
Loop
Web API
Let’s take the example:
Timer()
Duration: 0ms
Callback: anonymous()
setTimeout(anonymous())
Executing

Call Stack
Callback Queue
Event
Loop
Web API
Let’s take the example:
console.log(“I’m JavaScript’”)
Timer()
Duration: 0ms
Callback: anonymous()
COMPLETED
anonymous()
Executing

Event Loop’s Job:
1. Check if call stack is empty.
2. If empty, pop the callback queue,
and push the callback function to
the call stack, else wait.
3. Execute the call stack.
Call Stack
Event
Loop
Web API
Let’s take the example:
anonymous()
anonymous()
Callback Queue
Executing

Event Loop’s Job:
1. Check if call stack is empty.
2. If empty, pop the callback queue,
and push the callback function to
the call stack, else wait.
3. Execute the call stack.
Call Stack
Event
Loop
Web API
Let’s take the example:
anonymous()
Callback Queue
console.log(“Timeout!”)
Executing

Event Loop’s Job:
1. Check if call stack is empty.
2. If empty, pop the callback queue,
and push the callback function to
the call stack, else wait.
3. Execute the call stack.
Call Stack
Event
Loop
Web API
Let’s take the example:
anonymous()
Callback Queue
Executing

Event Loop’s Job:
1. Check if call stack is empty.
2. If empty, pop the callback queue,
and push the callback function to
the call stack, else wait.
3. Execute the call stack.
Call Stack
Event
Loop
Web API
Let’s take the example:
Callback Queue
Terminated
Event Loop’s Job:
1. Check if call stack is empty.
2. If empty, pop the callback queue,
and push the callback function to
the call stack, else wait.
3. Execute the call stack.
Synopsis of the Demo
‱ So event loop helps in concurrency of multiple operations. Yes it is true.
‱ But still JS is single-threaded and event loop has to wait for the call stack to get empty.
‱ Event Loop is also responsible for firing the callbacks associated with events.
‱ So JavaScript without it’s runtime having the event loop, and Web API, event handling or
asynchronous execution cannot be achieved.
‱ Call Stack and Events Demo: https://bit.ly/event-loop-demo
Why Asynchrony is needed?
‱ Asynchronous execution is needed, because Browsers!.
‱ Browser’s webpage rendering and JS execution engine runs on the same thread.
‱ So, if JS is busy executing some stuff, browser rendering is stuck until JS’s call stack gets empty.
‱ [Code Demo]
Fun Fact about Callbacks
‱ Callbacks need not be always asynchronous!
‱ Callback functions can also be synchronous.
‱ So which callbacks are asynchronous? Event handlers and Timers are.
‱ Which is not? Array.forEach()
‱ Custom callbacks need not be.
‱ For Example:
Array.forEach(callback) isn’t asynchronous.
https://bit.ly/array-foreach-demo
Thank You!
That’s how event handling and asynchrony works in JavaScript.
Thanks to Event Loop!

More Related Content

What's hot (20)

PPTX
All you need to know about the JavaScript event loop
SaĆĄa Tatar
 
PPTX
jQuery
Jay Poojara
 
PPT
Introduction to Javascript
Amit Tyagi
 
PPTX
Introduction to spring boot
Santosh Kumar Kar
 
PDF
JavaScript Event Loop
Derek Willian Stavis
 
PPT
React native
Mohammed El Rafie Tarabay
 
PPTX
[Final] ReactJS presentation
æŽȘ éčć‘
 
PDF
Understanding the nodejs event loop
Saurabh Kumar
 
PPTX
Introduction to Spring Boot
Purbarun Chakrabarti
 
PPTX
ReactJS presentation.pptx
DivyanshGupta922023
 
PDF
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
PPTX
Advance Java Topics (J2EE)
slire
 
PPTX
Reactjs
Neha Sharma
 
PPTX
Nodejs functions & modules
monikadeshmane
 
PDF
Callback Function
Roland San Nicolas
 
PDF
ReactJS presentation
Thanh Tuong
 
PDF
JavaScript Promises
Derek Willian Stavis
 
PPTX
JavaScript Promises
L&T Technology Services Limited
 
PDF
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
PDF
Spring boot introduction
Rasheed Waraich
 
All you need to know about the JavaScript event loop
SaĆĄa Tatar
 
jQuery
Jay Poojara
 
Introduction to Javascript
Amit Tyagi
 
Introduction to spring boot
Santosh Kumar Kar
 
JavaScript Event Loop
Derek Willian Stavis
 
[Final] ReactJS presentation
æŽȘ éčć‘
 
Understanding the nodejs event loop
Saurabh Kumar
 
Introduction to Spring Boot
Purbarun Chakrabarti
 
ReactJS presentation.pptx
DivyanshGupta922023
 
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
Advance Java Topics (J2EE)
slire
 
Reactjs
Neha Sharma
 
Nodejs functions & modules
monikadeshmane
 
Callback Function
Roland San Nicolas
 
ReactJS presentation
Thanh Tuong
 
JavaScript Promises
Derek Willian Stavis
 
JavaScript Promises
L&T Technology Services Limited
 
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
Spring boot introduction
Rasheed Waraich
 

Similar to JS Event Loop (20)

PDF
Javascript internals
Ayush Sharma
 
PPTX
JavaScript Engines and Event Loop
Tapan B.K.
 
PDF
The evolution of asynchronous javascript
Alessandro Cinelli (cirpo)
 
PPTX
Introduction to Node.js
NodeXperts
 
PDF
JavaScript for real men
Ivano Malavolta
 
PDF
Asynchronous development in JavaScript
Amitai Barnea
 
PPTX
JavaScript Multithread or Single Thread.pptx
RAHITNATH
 
PPTX
Javascript why what and how
sureshpraja1234
 
PPTX
Async discussion 9_29_15
Cheryl Yaeger
 
PPTX
The JavaScript Event Loop - Concurrency in the Language of the Web
marukochan23
 
PPTX
Events for JavaScript event loop track.pptx
sontinenianuradha
 
PDF
Developing Async Sense
Nemanja Stojanovic
 
PDF
Javascript: Behind the scenes.pdf
ShubhamChaurasia88
 
PPTX
Async js
lahin31
 
PDF
JavaScript
Ivano Malavolta
 
PDF
[2015/2016] JavaScript
Ivano Malavolta
 
PDF
Introduction to Node JS2.pdf
Bareen Shaikh
 
PDF
Event Driven Javascript
Federico Galassi
 
PDF
Understanding Asynchronous JavaScript
jnewmanux
 
PPT
Web development basics (Part-5)
Rajat Pratap Singh
 
Javascript internals
Ayush Sharma
 
JavaScript Engines and Event Loop
Tapan B.K.
 
The evolution of asynchronous javascript
Alessandro Cinelli (cirpo)
 
Introduction to Node.js
NodeXperts
 
JavaScript for real men
Ivano Malavolta
 
Asynchronous development in JavaScript
Amitai Barnea
 
JavaScript Multithread or Single Thread.pptx
RAHITNATH
 
Javascript why what and how
sureshpraja1234
 
Async discussion 9_29_15
Cheryl Yaeger
 
The JavaScript Event Loop - Concurrency in the Language of the Web
marukochan23
 
Events for JavaScript event loop track.pptx
sontinenianuradha
 
Developing Async Sense
Nemanja Stojanovic
 
Javascript: Behind the scenes.pdf
ShubhamChaurasia88
 
Async js
lahin31
 
JavaScript
Ivano Malavolta
 
[2015/2016] JavaScript
Ivano Malavolta
 
Introduction to Node JS2.pdf
Bareen Shaikh
 
Event Driven Javascript
Federico Galassi
 
Understanding Asynchronous JavaScript
jnewmanux
 
Web development basics (Part-5)
Rajat Pratap Singh
 
Ad

Recently uploaded (20)

PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Executive Business Intelligence Dashboards
vandeslie24
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Ad

JS Event Loop

  • 1. JS Event Loop BY SAAI VIGNESH P
  • 2. Agenda ‱ Before getting on to the main topic, we’ve to re-iterate on: ‱ What is JavaScript? ‱ JS Runtime Environment ‱ Synchrony and Asynchrony ‱ Event Loop ‱ What is Event Loop? ‱ How it works? ‱ Why do we need it? ‱ Code Example Demonstration
  • 3. What is JavaScript? ‱ JavaScript is a lightweight, cross-platform, and interpreted scripting language. It is used for web development, both client-side and server-side. ‱ It is based on the ECMAScript Specification (ECMA-262 standard). ‱ The language is: ‱ Single Threaded (Synchronous) ‱ Event-driven (events are emitted and handled) ‱ Imperative (explicit instructions) ‱ Functional (creating and using functions)
  • 4. JS Runtime Environment ‱ The JavaScript runtime environment provides access to built-in libraries and objects that are available to a program so that it can interact with the outside world and make the code work. ‱ The environment consists of: ‱ Execution Engine (Google V8) ‱ Web API – Browser; Low Level API – Node.js ‱ Callback Queue ‱ Event Loop
  • 5. Synchrony and Asynchrony Synchronous Calls: ‱ Code executes in the order they are called. ‱ The previous operation/function call should be completed or done for the control to get transferred. ‱ i.e., they are blocking. ‱ Guess the output !
  • 6. Output: I’m Function 1 I’m Function 2 I’m Function 3
  • 13. Explanation Call Stack fun1() console.log(“I’m Function 2”) fun2() Output: I’m Function1 I’m Function 2
  • 16. Explanation Call Stack fun1() fun2() fun3() console.log(“I’m Function 3”) Output: I’m Function1 I’m Function 2 I’m Function 3
  • 17. Explanation Call Stack fun1() fun2() fun3() Output: I’m Function1 I’m Function 2 I’m Function 3
  • 18. Explanation Call Stack fun1() fun2() Output: I’m Function1 I’m Function 2 I’m Function 3
  • 19. Explanation Call Stack fun1() Output: I’m Function1 I’m Function 2 I’m Function 3
  • 20. Explanation Call Stack Output: I’m Function1 I’m Function 2 I’m Function 3
  • 21. Blocking Call Example ‱ Imagine downloading a 10 MB image from Internet with JavaScript, with an internet speed of 1 MB/sec in a browser. ‱ It would ideally take 10 seconds to load the image. ‱ For these 10 seconds, no other operations can be done including rendering. ‱ Once download completes, rest of the operations can be executed. ‱ This is called a synchronous/blocking call. ‱ Solution: Async calls!
  • 22. Synchrony and Asynchrony Asynchronous Calls: ‱ Code executes and the control is returned no matter whether the operation is completed or not. ‱ i.e., they are non-blocking. ‱ But how to know that they are complete? Use callbacks! Output: Hello World I’m JavaScript Timeout!
  • 23. Callbacks? What are they? ‱ A callback is a function passed into another function as an argument, which is then invoked inside the function to complete some kind of routine or action. ‱ They are usually used with asynchronous operations. eg: background operations. ‱ Example: setTimeout() and setInterval() works asynchronously.
  • 24. Background Ops? SOUNDS GOOD
 BUT HOW?? Cause JavaScript is: ‱ Single Threaded, which means it has only one Call Stack!!
  • 25. One more confusion
 If JavaScript is Single Threaded, Then how setTimeout() / setInterval() works?
  • 26. Here’s where, We’ve to know some facts

  • 27. Timer Functions & I/O ‱ JavaScript – No native asynchrony ‱ JavaScript does not have support for Timer and I/O, they’re not part of the language (ECMAScript specification). ‱ Timer functions such as: ‱ setTimeout() ‱ setInterval() ‱ Input/output functions such as: ‱ console.log() ‱ console.error() ‱ Which means they are implemented by someone else. ‱ Who? It’s the runtime environment (Browser (Web API) / Node.js).
  • 29. JavaScript Event Loop ‱ The event loop is a programming construct or design pattern that waits for and dispatches events or messages in a program. Source: Wikipedia ‱ It is by which the JavaScript language behaves like a multi-threaded, being single-threaded by nature. ‱ It is a form of concurrency achieved to support asynchronous calls in JavaScript. ‱ So how it works? Let’s see

  • 31. Coding to demonstrate Event Loop Try guessing the output?
  • 32. Coding to demonstrate Event Loop Try guessing the output? Hello World I’m JavaScript Timeout! Output:
  • 33. Coding to demonstrate Event Loop Try guessing the output? Hello World I’m JavaScript Timeout! Output: Hello World I’m JavaScript Timeout! Output:
  • 34. Let’s see how, THAT STUFF HAPPENS

  • 35. Call Stack Callback Queue Event Loop Web API Let’s take the example: Start Execution!
  • 36. Call Stack Callback Queue Event Loop Web API Let’s take the example: console.log(“Hello World”) Executing

  • 37. Call Stack Callback Queue Event Loop Web API Let’s take the example: Timer() Duration: 0ms Callback: anonymous() setTimeout(anonymous()) Executing

  • 38. Call Stack Callback Queue Event Loop Web API Let’s take the example: console.log(“I’m JavaScript’”) Timer() Duration: 0ms Callback: anonymous() COMPLETED anonymous() Executing
 Event Loop’s Job: 1. Check if call stack is empty. 2. If empty, pop the callback queue, and push the callback function to the call stack, else wait. 3. Execute the call stack.
  • 39. Call Stack Event Loop Web API Let’s take the example: anonymous() anonymous() Callback Queue Executing
 Event Loop’s Job: 1. Check if call stack is empty. 2. If empty, pop the callback queue, and push the callback function to the call stack, else wait. 3. Execute the call stack.
  • 40. Call Stack Event Loop Web API Let’s take the example: anonymous() Callback Queue console.log(“Timeout!”) Executing
 Event Loop’s Job: 1. Check if call stack is empty. 2. If empty, pop the callback queue, and push the callback function to the call stack, else wait. 3. Execute the call stack.
  • 41. Call Stack Event Loop Web API Let’s take the example: anonymous() Callback Queue Executing
 Event Loop’s Job: 1. Check if call stack is empty. 2. If empty, pop the callback queue, and push the callback function to the call stack, else wait. 3. Execute the call stack.
  • 42. Call Stack Event Loop Web API Let’s take the example: Callback Queue Terminated Event Loop’s Job: 1. Check if call stack is empty. 2. If empty, pop the callback queue, and push the callback function to the call stack, else wait. 3. Execute the call stack.
  • 43. Synopsis of the Demo ‱ So event loop helps in concurrency of multiple operations. Yes it is true. ‱ But still JS is single-threaded and event loop has to wait for the call stack to get empty. ‱ Event Loop is also responsible for firing the callbacks associated with events. ‱ So JavaScript without it’s runtime having the event loop, and Web API, event handling or asynchronous execution cannot be achieved. ‱ Call Stack and Events Demo: https://bit.ly/event-loop-demo
  • 44. Why Asynchrony is needed? ‱ Asynchronous execution is needed, because Browsers!. ‱ Browser’s webpage rendering and JS execution engine runs on the same thread. ‱ So, if JS is busy executing some stuff, browser rendering is stuck until JS’s call stack gets empty. ‱ [Code Demo]
  • 45. Fun Fact about Callbacks ‱ Callbacks need not be always asynchronous! ‱ Callback functions can also be synchronous. ‱ So which callbacks are asynchronous? Event handlers and Timers are. ‱ Which is not? Array.forEach() ‱ Custom callbacks need not be. ‱ For Example: Array.forEach(callback) isn’t asynchronous. https://bit.ly/array-foreach-demo
  • 46. Thank You! That’s how event handling and asynchrony works in JavaScript. Thanks to Event Loop!