Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Isn't a synchronous call just an asynchronous call with a small timeout value?

I am a bit confused as to why a synchronous call is different to an asynchronous call, as there is never an "immediate" response, it still takes some nano or milliseconds?

like image 611
yazz.com Avatar asked Mar 17 '10 09:03

yazz.com


1 Answers

A synchronous call returns to its caller after finishing its job (or reaching timeout). An asynchronous call returns immediately after starting some other activity.

This means that, for a synchronous call, the caller waits - is completely blocked - while the called activity happens; an asynchronous call returns almost immediately to the caller although all that's happened is that the activity was started. As a result, after an asynchronous call, the called activity runs in parallel to the calling activity.

There's often some mechanism for the asynchronously started activity to "report back" that it's finished, or the calling activity may poll or otherwise look for evidence of completion of the asynchronous task.

like image 76
Carl Smotricz Avatar answered Jan 01 '23 23:01

Carl Smotricz