Open In App

What is a demultiplexer ?

In this article, we will learn about the demultiplexer in Node.js and about its reactor pattern.

Node.js is the most advanced framework available for web development and programming available till now. But Node.js framework is based on the event-driven architecture, i.e it will generate all the operations that will occur in the program and will have to wait for the I/O unit to request for the event which will eventually take place through the event demultiplexer and the event queue through which the instructions are passed to the computer.



Event looping:

The series of steps in which the event looping in Node.js takes place is as follows:



Event looping allows the user to create an infinite set of instructions for the processor in Node.js as it is an event-driven architecture process. Whenever any request to carry out a process comes, it goes to the event demultiplexer which sends the request of the process to the processor to apply the operation and add it to the queue and provides a callback option. The event queue then traverses all the data and applies de queue operation to them. The above process runs continuously until the event queue finally becomes empty and there are no processes left to execute, the event loop stops the process.

Reactor Pattern:

The Reactor Pattern in the Node.js web framework plays an important role in the functionality of the demultiplexer in the program. The Reactor Pattern pattern allows the user to prevent the stoppage of the operations which are processed by the I/O Unit operations. The I/O unit operations are directly provided to the demultiplexer in Node.js to avoid the blockage of the I/O requests. 

Basically two types of I/O unit operations:

Importance of Demultiplexer:

Article Tags :