Sign in
Log inSign up
Concurrency in Web Development

Concurrency in Web Development

Seun Ogundele's photo
Seun Ogundele
·Jan 26, 2021·

3 min read

Concurrency is defined by the dictionary as the fact of two or more events or circumstances happening or existing at the same time but in regarding to computer and web development, it is the ability to execute more than one program or task simultaneously. Concurrency is very common in modern programming. There are different methods that can be used to implement concurrency programs or concurrency programming languages, such as implementing each computational execution as an operating system process, or implementing the computational processes as a set of threads within a single operating system process.

Asynchronous programming roles in concurrency

Concurrency and Asynchronous programming share a lot of similarity and one can say they are one of the same, Asynchronous programming was devised to accommodate for the lag between when a function is called to when the value of that function is returned, with this definition we can understand concurrency can only be implemented with full functionality with the help of Asynchronous programming.

How are web APIs related to implementing concurrency?

There are two basic units of concurrency and web API uses a thread, A ​thread is the unit of execution within a process. A process can have one or more threads, APIs need to wait for a response to be able to deliver data or information and concurrency allows a user to go about thier business in an application, while processes run in the background, thus enhancing the user experience.

What is the event-loop in JavaScript and how does it relate to concurrency?

A loop is a programming structure that repeats a sequence of instructions until a specific condition is met so event loop is the secret behind JavaScript’s asynchronous programming and the name is self described because of how it's usually implemented. Javascript executes all operations on a single thread, but using a few smart data structures, it gives us the illusion of concurrency.

Compare the way Oracle and MongoDB support database concurrency

Its is imperative for database to support concurrency or have their own version of it because different user or admin access data all the time and they can make CRUD operations now and then.

MongoDB allows multiple clients to read and write the same data. In order to ensure consistency, it uses locking and other concurrency control measures to prevent multiple clients from modifying the same piece of data simultaneously. These concurrency control ensures that database operations can be executed concurrently without compromising correctness. Pessimistic concurrency control, such as used in systems with locks, will block any potentially conflicting operations even if they may not turn out to actually conflict

Oracle make use of isolation model called serializability, The serializable mode of transaction behavior tries to ensure that transactions run in such a way that they appear to be executed one at a time, or serially, rather than concurrently. Oracle offers two isolation levels, providing application developers with operational modes that preserve consistency and provide high performance.