This blog is only my clutter thinking about async(ASIO / SR model comparison) and record the resouces that I readed.

the investigating process record

First, I only use asio as my networking library, and then I find the think-async and the video in it. So I know asio also is the asynchrounous modle at the first time, and I begin to investigate the async model in c++ standard committee. Then refer to the reference, I figure out the NetTS(aka. ASIO) has been the experimental standard at the 2014, but not layering as the P2300 Sender/Receiver model proposed. I want to know the detail and query some materials that is the references.

The Sender/Receiver understand

At the beginning, I do not understand what is the sender/recevier, instinctly it seems the goroutine concept, one channel that has sender and receiver. And I learn the video from Eric Niebler[The Range library author]. It explain std::future and std::promise pair limitation, and create the lazyfuture/lazypromise concept to break through. The LazyFuture and LazyPromise rename to Sender and Receiver. IMP, the Sender is send the value that program need, and Receiver receive the value from producer. So connecting them can connect the producer and consumer.

The important idea is lazy. Lazy cause the compiler can construct the task graph at compile time and optimize the compute process.

The ASIO design philosophy (from P2444)

  • Be flexible in supporting composition mechanisms, since the appropriate choice depends on the specific use case
  • Aim to support as many of the semantic and syntactic properties of synchronous operations as possible, since they enable simpler composition and abstraction
  • Application code should be largely shilded from the complexify of threads and synchronisation, due to the complexiry of handling events from different sources.

PS. eager execution matters for performance

references

extra reference