It can be helpful for users to know when an application is executing code in the background. If, for example, you wanted to include a Check Email button in your application, then it may be helpful to indicate when email is being checked so the user knows that pressing the button won't do anything. As a developer, this is most commonly seen in an IDE status bar, indicating that a build is in progress or a packaging task is running. If working on a laptop and fans start to spin, it's useful to know what's executing in the background so that any potential concerns can be put to one side for a while.
To support this type of interface update, we need to track when tasks start and stop. Depending on the type of visual design, there are two strategies we could use: a simple counter of background tasks or a list of running tasks. The former is far easier to implement but the latter is able to report more information to the application user. If you'll just use a spinner or an infinite progress bar, then the first strategy will work well. If, however, you want to add a status bar that shows the current running task, you'll need to go with the second.