Backlinks Graph
Backlinks
Table of Contents

Async

  2026-03-04

  Edited: 2026-03-04

Some discussion I found about threading and async, in rust context since that is initially where I found it, but could be generally extendable.

Future

The basic building block of async is the Future. A future is something like a value which will eventually be returned. In the mean time, one can poll the future to check if it is completed (and in rust actually advance its computation).

Executor

An executor continually polls futures. One issue is putting the executor to sleep, since a general usage of the executor might be

for future in futures {
    executor.poll(future);
}

without any form of delay, this can turn into a busy loop which is inefficient. To fix this, wakers are used.

Waker

Wakers are implemented on Futures and essentially can be used to notify the executor when polling a future is useful. So now #+BEGIN_SRC rust for future in futures_ready_list { executor.poll(future); } #+END_SRC rust

where once a future is ready via calling its wake() method, it gets added to futures_ready_list and gets polled. A waker could be an extra thread, for example, which checks or polls for events.

Async Executor

Async generally includes a runtime, tokio for example, which handles scheduling of tasks among a series of threads. It appears a runtime can be avoided if only a single thread is used, via something like

The benefit seems to be simplicity and potential performance advantages due to having only a singular thread. However, the performance advantages does not seem to be as well due to constructs like LocalExecutor being built on async primitives which assume multiple threads.

Thread Per Core?

Need more reading on this, seems like it is optimized for I/O-bound workloads and takes advantage of the single thread advantage from before. See glommio.

Embedded

Something like embassy?

References