Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
Nodejs message queue vs macrotask queue

What is the difference between message queue and macrotask queue? Is it the same thing?

On Nodejs documentation here it says:

When setTimeout() is called, the Browser or Node.js starts the timer. Once the timer expires, in this case immediately as we put 0 as the timeout, the callback function is put in the Message Queue.

While, in this section, it says:

A setTimeout, setImmediate callback is added to macrotask queue

So, does message queue and macrotask queue is the same thing?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It refers to the same thing here. One could say that "message queue" is a more general term, as in "the microtask queue and the macrotask queue are both message queues".

about 4 years ago · Juan Pablo Isaza Relatório

0

If I am reading this right, it seems the "Message Queue" is a general term that is implemented using a few different queues.

In this section they explain:

A process.nextTick callback is added to process.nextTick queue. A Promise.then() callback is added to promises microtask queue. A setTimeout, setImmediate callback is added to macrotask queue.

Looks like the macrotask, microtask, etc. are specific parts of the implementation and have different attributes.

For example, execution order:

Event loop executes tasks in process.nextTick queue first, and then executes promises microtask queue, and then executes macrotask queue.

Found another easy explanation here.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda