How is concurrency used with Node.js
HOW IS CONCURRENCY IMPLEMENTED WITH NODE ? Concurrency means a program is able to run more than one task at a time this is not to be confused with the concept of parallelism. During concurrency , different tasks with different goals can be performed at the same time , while in parallelism different parts of the program execute one task. NodeJS uses an event loop to maintain concurrency. An event loop is something that pulls stuff out of the queue and places it onto the function execution stack whenever the function stack becomes empty. As soon as NodeJS starts , it initializes an event loop. The event loop works on a queue ( called an event queue) and performs tasks in FIFO ( First In First Out ) order Asynchronous programming is a technique that enables your program to start a long running task as well as respond to other events while that task is running or being processed rather then having to wait until a single task has been completed. You can write code as tasks , whi...