B
B
beduin012016-02-01 19:05:17
Programming
beduin01, 2016-02-01 19:05:17

What are the advantages of asynchronous programming?

I used to think that asynchrony is only needed for the slow web, when the request should not hang up all the rest of the processing. However, it turned out that for the desktop there are libraries like this https://github.com/Reactive-Extensions/Rx.NET
Question. What are the advantages and disadvantages of this approach? Is the code getting harder to maintain? Where is it advisable to apply, and where will it interfere?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Stalker_RED, 2016-02-01
@Stalker_RED

The thing is... there is no "synchronous" programming. The processor itself is asynchronous. There, under the hood, interrupts, context switches, that's all. And synchronicity is just an illusion created to "facilitate" writing programs.
https://habrahabr.ru/post/216659/
https://habrahabr.ru/post/201826/

N
nirvimel, 2016-02-01
@nirvimel

Reactive programming is another buzzword commonly referred to as the Actor Model , another approach to parallel computing alternative to classical threads (threads are used internally under the hood, of course, but not having to manually use locks eliminates many potential bugs and dire consequences in race conditions and deadlocks).
All this has little to do with asynchrony in single-threaded (!) Javascript, which does not provide any parallelization of calculations.

A
Andrew, 2016-02-01
@iCoderXXI

I wrote desktop applications a long time ago, even under DOS on Clipper 5.2, and before that in general on Borland Pascal 6/7. As soon as a more or less long-running calculation appeared in the code, the interface would freeze and the interactive would be reduced to zero.
It seems to me that today it is very wonderful to be able to asynchronously and multi-threadedly separate the interface from all sorts of long-running procedures so that the user does not think that the computer is frozen.

R
res2001, 2016-02-01
@res2001

The advantage of asynchronous IO over threads is that there is no overhead for maintaining threads. But programming AIO is quite difficult, comparable to the complexity of programming multi-threaded/multi-process applications.
From life: Apache - threads, nginx - AIO. Those. with the right approach, the gain from AIO is higher than from threads.
Should be used in applications where there is a lot of I / O operations.

L
lega, 2016-02-01
@lega

What are the advantages of asynchronous programming?

Nothing, it's just a necessity for some platforms (where you need to roll io locks) that fibers / coroutines / goroutines, etc. can not. (i.e. synchronous style with non-blocking io).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question