diff --git a/README.md b/README.md index 29d59973da8002ae5876a13584d292e1126a6ebf..c567f44d43835c5271070f7585cb50d1681b6366 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,20 @@ Rust asynchronous runtime, provides functionalities such as spawning async tasks ylong_runtime depends on the other three crates. - ylong_io: provides event-driven net io, using epoll or iocp to achieve non-blocking tcp or udp - ylong_ffrt: provides function flow runtime APIs. It serves as an alternative scheduler for ylong_runtime. -- ylong_macros: provides procedural macros for `select!` and ``main``/``test``. +- ylong_macros: provides procedural macros for `select!`. + +### Runtime framework +![runtime_framework](./figures/runtime_framework.png) + +ylong_runtime's APIs could be divided into four different modules: +- Sync: Synchronization mechanism. +- Async IO: Asynchronous net IO and file IO. +- Parallel Calculation: Parallel iterator and concurrent calculation. +- Timer: Asynchronous timer. + +For inner layer, there are Reactor and Executor: +- Reactor: Listens to system events such as IO and also timer events. Wakes the corresponding tasks through the events. +- Executor: Schedules and executes each tasks. There are two interchangeable executors for the runtime. ## Compile Build @@ -68,7 +81,9 @@ ylong_runtime | | |── core_affinity # Vore affinity components | | └── num_cpus # Num cpus components | └── tests # Sdv of ylong_runtime -└── ylong_runtime_macros # Macros for runtime +└── ylong_runtime_macros + |── examples # Examples of ylong_macro + └── src # Procedural macro implementation for runtime ``` ## Usage diff --git a/README_zh.md b/README_zh.md index 50cb8934bbd74a069bdb356ed3249fac4dbf2790..d4d434d2f1a28bd0a8f43ad2ac2a4bb29cb96071 100644 --- a/README_zh.md +++ b/README_zh.md @@ -3,16 +3,29 @@ ## 简介 Rust异步运行时库,用于生成并执行异步任务。同时提供了异步网络IO,异步文件IO,定时器,同步原语,并行迭代器等功能。 -### 图一 整体架构图 +### 图1 整体架构图 ![structure](./figures/structure.png) -### 图二 模块间关系 +### 图2 模块间关系 ![inner_dependencies](./figures/inner_dependencies.png) ylong_runtime 依赖以下三个库 - ylong_io: 提供了事件驱动型网络IO,通过epoll或iocp实现了非阻塞性的tcp和udp。 - ylong_ffrt: 提供了Function Flow Runtime的接口,可作为ylong_runtime的底层调度器。 -- ylong_macros: 提供了ylong_runtime所需的过程宏功能,用于`select!`功能, 以及`main`/`test`。 +- ylong_macros: 提供了ylong_runtime所需的过程宏功能,用于`select!`功能。 + +### 图3 Runtime结构图 +![runtime_framework](./figures/runtime_framework.png) + +ylong_runtime对外API分为四个模块: +- Sync: 同步原语 +- Async IO: 异步网络IO & 文件IO +- Parallel Calculation: 并行计算 +- Timer: 异步计时器 + +对内模块分为Reactor以及Executor +- Reactor: 进行IO等系统事件以及Timer事件的监听,并通过监听到的事件唤醒对应任务。 +- Executor: 进行任务调度以及任务执行的主体,ylong_runtime拥有两个可互相替换的调度器。 ## 目录 ``` @@ -51,7 +64,9 @@ ylong_runtime | | |── core_affinity # 绑核实现 | | └── num_cpus # 获取核数实现 | └── tests # ylong_runtime 测试用例 -└── ylong_runtime_macros # ylong_runtime 宏实现 +└── ylong_runtime_macros + |── examples # ylong_runtime_macros 代码示例 + └── src # ylong_runtime 过程宏实现 ``` ## 编译构建 diff --git a/figures/runtime_framework.png b/figures/runtime_framework.png new file mode 100644 index 0000000000000000000000000000000000000000..ff94bf03655cfd708f9bed019ed5b1bc128b5307 Binary files /dev/null and b/figures/runtime_framework.png differ diff --git a/figures/structure.png b/figures/structure.png index 1234e3c41369ac4d2b63d5a091e0e40057050b14..5800a0c04ebcc847f742ec37fee94cef09831c2d 100644 Binary files a/figures/structure.png and b/figures/structure.png differ