A blocking operation is an operation that must be completed before the next operation can take place. Most programs are written serially, meaning each instruction must execute before the next instruction. The problem, however, is that some operations can be executed in parallel (that is, either concurrently or asynchronously). Serializing these operations can, in the best case, lead to poor performance and, in some cases, can actually lead to deadlock (the program entering an endless wait state) if the operation that is blocking is waiting on another operation that is never given a chance to execute.
To demonstrate a blocking operation, let's examine the following:
#include <vector>#include <iostream>#include <algorithm>