Похожие чаты

NodeJS is single threaded for a program that reads a

file asyncronously
in this program
if file reading operation starts and the method give the control back to the main execution so that the remaingn code can execute
cool
now as said before it is single threaded than how the multi execution will take place
i.e 1) reading the file
2) exectuing the next statements
as node is just a single threaded

also what if the very next execution needs the upper execution' result (which is async operation)
for this particular case. there would be no any advantage for aysnc right ?

1 ответов

10 просмотров

node makes an asynchronous call to read the file, remembers to call a callback when reading is done, and continues to execute the current stack. When node is idle, it waits for the os to report it's done reading the file, and then it calls the callback there would be no any advantage for aysnc right ? there is. While the async operation is not done yet, node can run other code, such as processing other requests

Похожие вопросы

Обсуждают сегодня

For managing user-generated content rights in gaming? 🤯🚀
Brian
37
Do we have a Chinese community here?
迪迦
20
Hello! This is Tayla from StealthEX crypto exchange. BCH is listed on our platform. Who can I talk to regarding marketing collaboration?
Tayla
13
@Aiwan что такое база образца?
Alexey
27
Hello, Ergo Investor here. Had a few questions for the leadership of the project, from what I’ve seen @kushti_ru , @Armeanio @dadreboi In one sentence, what is your vision f...
A
16
Не многие знают, а кто знает, тот уже успел забыть, что в далёком 2004 году эта игра произвела настоящий фурор, настолько революционной была технология, применяемая для её соз...
ICCID
4
Why binance delisting the token?
🅰🅽🅳🆁🅴🆆
14
Hi is Atomic wallet safe to exchange btc to xmr?
Regex
20
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
Короче я тут узнал полный пиздец Что кучу постов которые я создавал через posted Спустя время не могу редактировать и менять Мол телега возвращае ошибку Это реально так ...
inc.
13
Карта сайта