# libaco **Repository Path**: eric3495/libaco ## Basic Information - **Project Name**: libaco - **Description**: 基于ACO改版的协程调度器 - **Primary Language**: C - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2025-10-10 - **Last Updated**: 2025-12-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # libaco #### 介绍 基于ACO改版的协程调度器,新增组件: - ​​arm架构协程 (aco.h/acosw.S):增加ARM/AARCH64架构支持 - ​​协程管理​​ (aco.h/aco.c):基础协程的创建、切换和销毁 - ​​调度器​​ (aco-scheduler.h):多线程任务调度和负载均衡 - ​​事件循环​​ (aco-event.h):事件等待和通知机制 - ​​异步 I/O​​ (aco-socket.h):非阻塞 Socket 操作封装 - ​​定时器系统​​ (twtimer.h):高效的时间轮定时器 - ​​通道通信​​ (aco-channel.c):协程间通信机制 #### 软件架构 软件架构说明: ``` +----------------------------------------------------------------------------------------+ | Application Layer | | | | +-------------------+ +-------------------+ +-------------------+ | | | User Task 1 | | User Task 2 | | User Task N | | | +-------------------+ +-------------------+ +-------------------+ | | | aco_worker_submit | | aco_worker_timer | | aco_worker_msleep | | | | aco_worker_resume | | aco_worker_iowait | | aco_channel_* | | | +-------------------+ +-------------------+ +-------------------+ | +----------------------------------------------------------------------------------------+ | Scheduler API Layer | | +---------------------------------------------------------------------------+ | | | aco_scheduler_t | | | | +---------------------+ +---------------------+ +---------------------+ | | | | | aco_worker_t | | aco_worker_t | | aco_worker_t | | | | | +---------------------+ +---------------------+ +---------------------+ | | | | | - ready_queue | | - ready_queue | | - ready_queue | | | | | | - waiting_queue | | - waiting_queue | | - waiting_queue | | | | | | - suspended_queue | | - suspended_queue | | - suspended_queue | | | | | | - timer_wheel | | - timer_wheel | | - timer_wheel | | | | | | - stack_pool | | - stack_pool | | - stack_pool | | | | | | - io_ctx | | - io_ctx | | - io_ctx | | | | | +---------------------+ +---------------------+ +---------------------+ | | | +----------------------------------------------------------------------------+ | +----------------------------------------------------------------------------------------+ | Core Coroutine Layer | | +--------------------------+ +--------------------------+ | | | aco_t | | aco_share_stack_t | | | +--------------------------+ +--------------------------+ | | | - reg[] | | - ptr | | | | - main_co | | - sz | | | | - fp | | - align_highptr | | | | - save_stack | | - align_retptr | | | | - share_stack | | - align_validsz | | | +--------------------------+ +--------------------------+ | | | aco_create() | | aco_share_stack_new() | | | | aco_resume() | | aco_share_stack_destroy | | | | aco_yield() | +--------------------------+ | | | aco_destroy() | | | +--------------------------+ | +----------------------------------------------------------------------------------------+ | Platform Specific Layer | | +-----------------------------+ +-----------------------------+ | | | x86/x64 | | ARM/ARM64 | | | +-----------------------------+ +-----------------------------+ | | | - Register saving/restoring | | - Register saving/restoring | | | | - FPU state management | | - FPU state management | | | | - Stack manipulation | | - Stack manipulation | | | +-----------------------------+ +-----------------------------+ | | | acosw() assembly function | | acosw() assembly function | | | +-----------------------------+ +-----------------------------+ | +----------------------------------------------------------------------------------------+ | System Resource Layer | | +---------------------+ +---------------------+ +---------------------+ | | | Epoll/IOCP | | Timer FD | | Event FD | | | +---------------------+ +---------------------+ +---------------------+ | | | - Non-blocking I/O | | - Timer management | | - Inter-thread | | | | - Event notification| | - Timeout handling | | communication | | | +---------------------+ +---------------------+ +---------------------+ | +----------------------------------------------------------------------------------------+ ``` #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)