DEV Community

Saurabh Sharma
Saurabh Sharma

Posted on

Explain use of concurrency Like I'm Five

Top comments (1)

deciduously profile image
Ben Lovy • Edited

If I'm understanding the question correctly, a good simple example of an application that leverages concurrency is a webserver. When a server receives an incoming request, it should be able to process that request without stopping any other incoming requests. That is, if this request needs to read a database and do a transformation, it should be able to also respond to other incoming requests and queue up their work at the same time as it's working on the database request. This is how, say, is able to have all of us browsing and commenting at the same time without the blocking each other from accessing the site. If DEV were not concurrent, me posting a comment would mean that nobody else could load the home page while it was working on that.

If you're looking for how to write a concurrent program, it's a huge topic! There are a number of different ways to go about it. Do you have a specific language/stack in mind?