异步编程有很多成功的应用,例如lwIP、Nginx、Node.js、Linux AIO、JavaScript等。可以将这些成功案例的设计经验引入到嵌入式软件。
lwIP
The raw TCP/IP interface allows the application program to integrate better with the TCP/IP code. Program execution is event based by having callback functions being called from within the TCP/IP code.
The raw TCP/IP interface is not only faster in terms of code execution time but is also less memory intensive.
《基于回调的lwIP raw API》
Nginx
Nginx uses an asynchronous event-driven approach to handling requests. Nginx’s modular event-driven architecture can provide more predictable performance under high loads.
《深入理解Nginx:模块开发与架构解析(第2版) 》
- 第8章 Nginx基础架构
- 8.2 Nginx的架构设计
- 8.2.2 事件驱动架构
- 8.2.3 请求的多阶段异步处理
Node.js
Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
Node.jsNode.js@wikipedia
- 第 3 章 异步I/O
- 第 4 章 异步编程
Linux AIO
使用异步 I/O 可以帮助我们构建 I/O 速度更快、效率更高的应用程序。如果我们的应用程序可以对处理和 I/O 操作重叠进行,那么 AIO 就可以帮助我们构建可以更高效地使用可用 CPU 资源的应用程序。
JavaScript
《JavaScript异步编程:设计快速响应的网络应用》
- 第1章 深入理解JavaScript事件
- 第2章 分布式事件
- 第二部分 异步和性能
- 第 1 章 异步:现在与将来
- 第 2 章 回调
libevent
The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.
libev
A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs.
libuv
Node.js 用的就是libuv。
libuv is a multi-platform support library with a focus on asynchronous I/O.
Redis