Posts

Showing posts from November, 2022

How is concurrency used with Node.js

Image
  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...

What is concurrency and how do you implement it.

Image
  What is concurrency ? Concurrency means  multiple computations are happening at the same time . Concurrency is everywhere in modern programming, whether we like it or not: Multiple computers in a network. Multiple applications running on one computer. Multiple processors in a computer. To simply put it , it is the process where your device example desktop or laptop processes more then 1 program or command at a time. What are the concurrency types ? The three main types of concurrent computing are multi threading, asynchrony, and preemptive multitasking.  Parallel programming and distributed programming  are two basic approaches for achieving concurrency with a piece of software Threads are  the virtual components or codes, which divides the physical core of a CPU into virtual multiple cores.  Multithreading is  a technique that allows for concurrent (simultaneous) execution of two or more parts of a program for maximum utilization of a CPU . In compu...