How is asynchronous programming implemented under the hood without continuous cheching?

104 points spookie_cookie018

Hello guys, i ask the question here because i believe that rust programmers are aware of low-level stuff and the community is friendly. I am having a difficulty understanding how asynchronous programming works with good performance although someone has to check if some data is from I/O is ready, for example a asynchronous database call to fetch data or from the harddrive.

While I understand the basics of how this works conceptually, I'm interested in a deeper understanding of its implementation.

How is asynchronous programming implemented without resorting to busy waiting? For instance, is the kernel responsible for notifying the runtime by periodically checking a flag indicating data availability from the network adapter(example for asynchronous database call), or are there more efficient mechanisms involved? I'm interested in understanding the technical details of how this process avoids continuous checking for data availability while still ensuring timely execution of asynchronous methods.