Why is it called an Asynchronous method?

I was looking for an antonym for asynchronous (for documentation purposes) when I discovered that asynchronous means "not in parallel".

To me an asynchronous call was always one that effectively ran in parallel with my other code. I know this isn't really true as only one instruction can be computed at a time. But if an asynchronous call is not in parallel, what is code that runs right after another? Why are asynchronous calls derived from a word that means non-parallel if they appear to be even more parallel than normal code?


The antonym/opposite of "asynchronous" is "synchronous".

In the context of programming, "not in parallel" is a completely wrong definition for "asynchronous". That's just not what it means for us.

In practice, and in most programming languages, what "synchronous" really means is "this will happen right now, before the next line of code." What "asynchronous" really means is "this will happen at some point, but not necessarily right now; the next line of code may happen first." Note that this doesn't have to be something magical built into the language; pushing objects into a queue to get processed later is often considered asynchronous.

For a more precise, technical definition, the one Wikipedia uses on its disambiguation page is pretty good:

In computer programming, asynchronous events are those occurring independently of the main program flow. Asynchronous actions are actions executed in a non-blocking scheme, allowing the main program flow to continue processing.

Exactly when an "asynchronous" action gets performed depends on the mechanism you're using. In Javascript for instance, a setTimeout(callback, time) call will (roughly speaking) execute callback after time milliseconds pass.

Now, why do we use these terms?

I don't know for sure, but it's worth pointing out that whenever we have parts of our code running asynchronously, we usually have to "synchronize" them back up in order to get predictable behavior at the end. This typically means waiting for some set of async actions to complete. Synchronous code is essentially "synchronized" by default; it's impossible for ordinary statements to get executed out of order unless your compiler/interpeter is horribly broken (or doing clever optimizations). So it might help to think of "asynchronous" as implying "may need to be synchronized later".


"Parallel" is an odd definition of synchronous (which is the antonym for asynchronous). Synchronous means "at the same time". Thus asynchronous is "not at the same time".

Whilst no function will return a result at the same time as being called, to the calling code it appears to do so, as the latter's execution stops whilst the function runs. Thus such functions can be seen as synchronous. If a function allows the calling code to continue and then returns a result later, it's no longer synchronous; it's asynchronous.

By allowing the calling code to continue, it can be getting on with other things whilst the function is running; thus the two are parallel.