From 62b993e2c1e1ad029a96c1b3d477dd3a0745e0aa Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:57:28 +0200 Subject: [PATCH] Update README.md --- async-await/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/async-await/README.md b/async-await/README.md index 9751aeb..feed841 100644 --- a/async-await/README.md +++ b/async-await/README.md @@ -4,10 +4,12 @@ JavaScript is single-threaded but it can still take advantage of asynchronous programming. When we say JavaScript is single-threaded, we mean that we cannot write -multithread code without using JavaScript APIs. In fact, +multithread/concurrent code without using JavaScript APIs. In fact, despite for us it appears single-threaded, it takes advantage of the `libuv` library, allowing the engine to be effectively multithread. +Another way to put it is that we have one and only one Call Stack. + In order to do that, JavaScript uses * The libuv APIs which allow multithreading * The Event Loop Queue @@ -42,4 +44,9 @@ of by the `libuv` library which will be responsible for checking when 1000ms hav When 1000ms have elapsed, the callback function associated with the timer (console.log) gets enqueued in the Queue. Since there is nothing to do in the stack, the callback pushes the callback onto the -stack and executes it. \ No newline at end of file +stack and executes it. + +## Useful resources +* https://www.youtube.com/watch?v=lqLSNG_79lI +* https://dev.to/lydiahallie/javascript-visualized-event-loop-3dif +* https://www.youtube.com/watch?v=eiC58R16hb8 \ No newline at end of file