HOME       >>       Programming

Asynchronous Vs. Synchronous Execution What does it really mean?


hippiman

A while ago, I was learning about threads, and about asynchronous and synchronous functions.

The way this site explains it, synchronous code makes the current code wait for the function you called to return. Asynchronous functions are called, but the current code just continues after it starts the function.

What I don't understand is why they use them the way they do. I'm pretty sure synchronous means something about more than one thing being in sync.
("occurring or existing at the same time or having the same period or phase" from google's definition.)
Asynchronous is just the opposite, then, meaning more than one thing not being in sync.
("not occurring or existing at the same time or having the same period or phase ".)

So, if synchronous code has to wait for a return, that means that the current code and the called function are not executing at the same time, and therefore not synchronous, right?
And if asynchronous code doesn't wait for a return, that means the current code and the called function are executing at the same time, and not asynchornous.

I don't get it.

If someone has some better way of explaining it that makes their definitions make sense, I'd appreciate it.

It seems to me that they just used those words backwards to confuse people while they're explaining threads.


iGuest

Reply to: Asynchronous Vs. Synchronous Execution - What does it really mean?Asynchronous Vs. Synchronous Execution

The concept of synchronous and asynchronous calls is fine as youExplained it first. You may want to search for the concept of"concurrency" and concurrent processes execution since that's more orLess what you're pointing out on your comments.

-reply by Allan

iGuest

All in one process Vs occuring in different processesAsynchronous Vs. Synchronous Execution

This confused the hell out of me too.  I came to understand it this way.

Synchronous is a set of 2 distinct yet related concepts.  If you think of processing a web form, all of the steps in the web form occur in a single workflow process.  When submitting a web form for instance, you click submit you shake hands with data verification handling "synchronize" the data. Hence they are all part of one complete phase.

Asynchronous is a set of 2 separate processes executing.  The threads are executing at different times I.E. 2 different phases.

-reply by Mike


VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.