2025 Spring Opencamp of Kernel-Summary

开源操作系统训练营第四阶段总结 - Axembassy 模块化 起步 作为一名物理学学生,对于内核等相关方向一无所知,而进行异步方向的选择则仅仅因为第四阶段并没有更为清晰的介绍。但不论如何,学习任何知识,进行思考都不会有害。 尝试进行Embassy的组件化实际上只是最初的粗糙想法,并非深思熟虑的思考。但至少在初步的实践上迈出的这一步,不论坚实与否。 过程 刚开始的时候并未和老师联系,自己在一个人摸索。 在初步的摸索中尝试先进行用户态的Executor设计,参照源代码使用CondVar。这一部分的探索在Arceos中构建出CondVar后便结束。接下来想尝试注册时间相关的功能逻辑,在过程中因为对基础知识不熟悉,走了相当的弯路。代码应该少而精,而摸索总是草率和混乱的。 运行时植入线程的过程也并不顺利,特别是对于_pender()过程的思考过于复杂,无形中浪费了很多时间。这时向老师推荐我去阅读ArielOS的源码。在阅读和理清思路后,这一推进简洁了不少。 但是测试的结果虽然近似预期,但是测试的逻辑存在问题,这一问题则是在之后才发现并修正,在当时完成后便按照老师要求尝试进行优先级的构建。 优先级的构建仍有波折,主要的关键在于确定通过改变概率分布的方式调整poll的概率分布之后,如何动态调整优先级的检查以保证任务的抽取不会饥饿。这一点思考在几天后有了一定想法,各个优先级具有吸引优先级检查的能力,通过不同的吸引力来保证动态的可持续。 在进行包含优先级的测试时发现之前的测试出现问题,便着手在此重新完全测试。测试的结果显示出协程的一定优势。但是因为期末考试的冲突总结的完成迟迟滞后,老师推荐我尽量复习为重,但是老师也不断强调阶段性的成果展示,所以还是硬着头皮参加了最后的总结,成了反例。:( 未完待续 老师在最后总结也强调,阶段性的成果重要但不是真正的要求。学习和思考是持续不断的,所以这篇总结在现在完成,迟了半月却并非结束,而是未完待续。 雄关漫道真如铁,而今迈步从头越。

July 3, 2025 · nostalgia

AxEmbassy Report

Previous Next     / [pdf] View the PDF file here.

July 2, 2025 · nostalgia

AxEmbassy Preempt

Development Embassy use head insertion to add a new task, adn poll every task in sequence. In order to add preemption, we can’t modify embassy itself due to self-referent structure. Another strategy is to modify Future itself with a priority system to change the probability of polling distribution. To ensure a trace of future, we use TaskId. After a initiation of future, we insert it in Scheduler. struct PrioScheduler { // u64 is the count of task in given prio level....

June 12, 2025 · nostalgia

AxEmbassy Measure

We consider embassy task instance, which is async as same work unit as native thread. Thus we let them do same work, measure the deviation from the expected sleep time as the standard. (async) fn busy_work(iters: u64) -> u64 { let mut total = 0; for _ in 0..iters { total = black_box(total + 1); (yield_now.await/yield_now()) } black_box(total) } Above code is the busy work each thread/task need to do. With yield_now as a await point to fully exploit the mechanism of async....

June 7, 2025 · nostalgia

AxEmbassy Development

Design and Background AxEmbassy module is the incorporation of Embassy and Arceos. Mainly for aiding Arceos by async runtime of Embassy. We know, usually there are 3 ways for executor implementation. SWI software interrupt: Based on InterruptExecutor. Single thread: Based on Executor without threads interaction, immediately trapped in async process. Multi-thread: Based on Executor with threads interaction(waited to be designed) We choose last two methods, and tackle the design for multi-thread as the priority....

June 7, 2025 · nostalgia

Ariel Embassy

Embassy on Ariel-OS Executor Types They are multiple ways to implement and integrate embassy functionality. Embassy is a runtime existing in whole life time of program. Thus any async execution will be entrapped in runtime scheduling. First is the most simple, we directly entrap everything in such runtime scheduling. This means a sole thread. #[cfg(feature = "executor-single-thread")] #[unsafe(export_name = "__ariel_os_embassy_init")] fn init() -> ! { use static_cell::StaticCell; debug!("ariel-os-embassy::init(): using single thread executor"); let p = hal::init(); static EXECUTOR: StaticCell<hal::Executor> = StaticCell::new(); EXECUTOR ....

May 30, 2025 · nostalgia

Deploy WorkFlow(2)

Collaboration Rules You could set rules for collaboration and preventing safety issues. Usually, you want prevent someone modify main branch arbitrarily and restrict all push behavior after a carefully check on pr. Settings Rules restrict creations restrict update restrict deletions block force pushes Here are some simple block rules you want to set. Pull Request You should create a new branch to circumvent awkward situation for your modification, you can create a new pull request to do this in ease....

March 24, 2025 · nostalgia

Deploy WorkFlow(1)

Deploy of Blog Here a record of deployment of static blog by hugo Preparation Toolchain: hugo git Create Site hugo new site <your-name> cd <your-name> git init git submodule add https://gitclone.com/github.com/adityatelange/hugo-PaperMod.git themes/PaperMod Setting the theme to “PaperMod” # ... above content theme = "PaperMod" Workflow Configuration Git Ignore Setting .gitignore to remove auto-generated content .hugo_build.lock public/ resources/ Issue Template A readable template can help you classify issues, make it more understandable....

March 24, 2025 · nostalgia