+ 2

Asynchronous programming

I am confused in synchronous and asynchronous programming. Can anyone explain this in a simpler way?

30th Dec 2018, 10:07 AM
Suzan
Suzan - avatar
2 ответов
+ 9
I found this example at here ( https://stackoverflow.com/q/34680985/9132046 ) Synchronous: you cook the eggs, then you cook the toast. Asynchronous, single threaded: you start the eggs cooking and set a timer. You start the toast cooking, and set a timer. While they are both cooking, you clean the kitchen. When the timers go off you take the eggs off the heat and the toast out of the toaster and serve them. Asynchronous, multithreaded: you hire two more cooks, one to cook eggs and one to cook toast. Now you have the problem of coordinating the cooks so that they do not conflict with each other in the kitchen when sharing resources. And you have to pay them. https://code.sololearn.com/cgWlEb76yZ3i/?ref=app
30th Dec 2018, 11:47 AM
Mert Yazıcı
Mert Yazıcı - avatar
+ 3
Synchronus is the one where your code will be executed respect to it's position that it will block the next code after it until it is completed processing. Asynchronous is the one which will not affect it's childrens and runs int the background .
30th Dec 2018, 11:39 AM
Adarsh.n. Bidari
Adarsh.n. Bidari - avatar