5 minutes read

When we are considering some complex process, let's call it workflow, various parts of it may run differently. Sometimes actions go one by one, sometimes they go in random order overlapping each other, and sometimes things go simultaneously and in parallel. The workflow can evolve differently. There are three sorts of workflow executions sequence: synchronous, asynchronous, and parallel.

Many terms related to computer program processing are not just technical ones. They describe a wide variety of real-world phenomena. In some sense, the processes taking place inside a computer are not that different from those in real life. Moreover, on some level of abstraction, they are practically identical. So, let's try to use them and explore their base concepts using real-life examples.

An appropriate example of a complex process is customer service. Let's use it to study some basic types of workflow from the point of view of the sequence of execution.

Synchronous workflow

There are many models to manage customer flows. The simplest approach is one shop with one seller. The seller deals with each client from the beginning to the end of each sale and performs all the roles from storekeeper to cashier.

seller serving one customer at a time while other customers wait in line

When there are many customers at the same time, this approach is very far from perfect as the seller can deal only with one client per time, while others have to wait in line. They serve each client separately one by one which means starting to serve the next client only after finishing with the current. We name this type of action a synchronous one.

Synchronous workflows are very common. Most of the activities should go synchronously if their goal is to achieve some specific results. The number of examples is enormous. Scenes in a movie plot, car assembling, words in a sentence, cooking, you name it.

Asynchronous workflow

Let's imagine our old shop becomes fancier, this is a pizza shop now. After the first client has ordered their pizza, they need to wait for it to be cooked. At this point, the seller leaves the first customer alone for a while, and now the second one can make their order, then the third, and so on.

seller serving several customers simultaneously in overlapping periods

When the first client's pizza is ready, the seller returns to them to complete the sale. That's how this story will repeat again and again.

Our old friend seller can serve several customers simultaneously in overlapping periods. We call such behavior asynchronous.

Operations of this kind often emerge when there is a need for waiting. Imagine you are reading on an aircraft while flying, or you do the dishes while something is cooking; those pairs of activities are asynchronous.

Parallel processing

As the pizza shop sales are growing, now one worker is not enough for the whole business. So, we should hire several. If each seller has a separate compact oven for preparing exactly one pizza at a time, then we can divide the queue of buyers among the sellers.

multiple sellers each serving one customer at a time in parallel

Now each of them works independently, and this is a case of parallel processing. Each task in parallel processing is running in a continuous period as a whole unit process. Parallel execution is possible only if there is more than one executor. Cashiers in a supermarket are an example of parallel processing in everyday life, as well as highways.

Conclusion

So, there are three types of workflow processing. The first is synchronous, the second is asynchronous, and the third is parallel.

  • Synchronous: one task at a time, the next starts when the current is done.

  • Asynchronous: multiple tasks at the same time in overlapping periods, executed by little parts.

  • Parallel: multiple or one task split into parts, being executed continuously by different executors in parallel.

742 learners liked this piece of theory. 22 didn't like it. What about you?
Report a typo