Warm-up
The much talked
about in recent technology diaspora is async! It came with a flurry and still remains fuzzy to all of
us, including me, until I recalibrated by research antenna up towards it. I
come from primarily a web development platform and this article talks about async in client and server
languages that I have predominantly used. This blog post expounds the theory
behind asynchrony in modern languages like C# and JavaScript framework like
Nodejs.
Short Sprint
Historically we
have always dealt with predictable sequence of instructions that flows in
certain predetermined order with its logical & control structures in place.
Async is disrupting this. How? When single thread is assigned for the
completion of a software program then it is synchronous operation. This way
the thread in context is quasi utilised (or most of the times it’s just waiting
for an I/O operation to complete). This is not the economical way of exploiting
the precious thread execution time.
|
Figure 1 : Synchronous Operation
|
Figure 2: Asynchronous Operation
|
The downside of
the above execution approach is the thread which performs execution of the
three tasks (refer Figure 1) in certain order has to wait for the I/O
operations and walk through a sequence in spite of lag or lull. On the other
hand if one thread performs concurrently all the above three instruction (task)
sets by efficient context switching like in the above figure (2), then its
asynchronous operation.
Finish Line
There are
multitudes of technologies out there and there is no unique tool which is sharp
enough to solve all the real world problems out there. Likewise asynchronous
techniques are suited to chop the thread execution time and switch between
tasks when there is a lull due to I/O lag. This is suited for web related
problems but not for high intensive processor heavy lifting tasks. And that’s
where precisely my previous blog post kicks in <>.



