A guide to implementing Mutexes to tackle concurrency issues in Javascript.

JavaScript has a concurrency model based on the Event Loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks. This model is quite different from models in other traditional programming languages like C and Java.

Concurrency means multiple computations happening at the same time or concurrently. Concurrency means executing multiple tasks at the same time but not necessarily simultaneously. Concurrency is everywhere in modern programming, whether we like it or not: Multiple computers in a network. …


Javascript as we know it is single-threaded. A single-threaded language is one with a single call stack and a single memory heap. This means that a single thread of execution handles the entire event loop. Despite being single-threaded, Javascript is asynchronous and has been able to solve complex modern web application concerns pretty well so far. However, as the complexity of computing systems increased manifold, executing complicated algorithms on a single execution context became more cumbersome and resulted in the slow loading of websites, translating to poor user experience.

Javascript has the Event Loop which has provided asynchronicity to our…

Bidisha Mondal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store