tomaka / redshirt:在0环中运行的WASM二进制的操作系统原型
redshirt操作系统是建立某种形式与操作系统类似环境的实验,其中的可执行文件都在WASM并从类似IPFS的去中心化网络被加载。
此存储库中有两种二进制文件:
-
“托管内核”是执行WASM程序并使用主机操作系统的常规二进制文件。
-
独立式内核是兼容multiboot2的内核,可以与GRUB2或任何兼容的引导程序一起加载。
对于托管内核:
# You need the WASI target installed:
rustup target add wasm32-wasi
# Then:
cargo run
对于独立内核:
rustup target add wasm32-wasi
# From the root directory of this repository (where the `arm-freestanding.json` file is located):
RUST_TARGET_PATH=`pwd` cargo +nightly build -Z build-std=core,alloc --target arm-freestanding --package redshirt-standalone-kernel
# You now have a `target/arm-freestanding/debug/redshirt-standalone-kernel`.
# It can be loaded directly by QEMU:
qemu-system-arm -M raspi2 -m 2048 -serial stdio -kernel ./target/arm-freestanding/debug/redshirt-standalone-kernel
支持x86_64的独立内核:
RUST_TARGET_PATH=`pwd` cargo +nightly build -Z build-std=core,alloc --target x86_64-multiboot2 --package redshirt-standalone-kernel
前往GitHub了解更多。
Rust官方发布:任务监视器扩展task_scope
task_scope crates是一个运行时用于向现有运行时添加对结构化并发的支持的扩展。
什么是结构化并发?
结构化并发是一种编程范例,它允许异步操作仅在特定范围内运行,以便它们像常规函数调用堆栈一样形成操作堆栈。当父操作等待所有子代完成时,结构化并发有助于并发程序的本地引导。
可撤回点
task_scope
要求任务定期通过一个可撤回点才能有效地工作。
use tokio::io::*;
let mut read = repeat(42); // very fast input
let mut write = sink(); // very fast output
copy(&mut read, &mut write).await.unwrap();
实际上,该程序回进入无限循环,因为read
并且write
永远不会终止。更糟糕的是,程序无法从外部关闭,因为I / O操作始终会成功,并且copy
功能会尝试尽可能继续。因此,产生的任务必须协同检查取消或定期循环执行以保持结构良好。
task_scope
提供便利功能cancelable
以自动处理取消。它封装给特定的Future
/ AsyncRead
/ AsyncWrite
并在进行内部计算之前检查取消。
use futures::pin_mut;
use tokio::io::*;
use task_scope::cancelable;
let read = cancelable(repeat(42)); // very fast, but cancelable input
pin_mut!(read); // needed for Unpin bound of copy
let mut write = sink(); // very fast output
// this will terminate with an error on cancellation
copy(&mut read, &mut write).await.unwrap();
如果这个取消逻辑比较复杂,则可以使用Cancellation
手动轮询以检查取消信号。
详细信息前往Rust官方博客浏览
新版本sysinfo(OSX性能改进)
sysinfo用于创建系统信息(支持Linux,Windows,OSX,Android和raspberry pi)。
此版本是性能改进系列的最后一个版本,专注于OSX。
关于sysinfo前往GitHub了解更多。
前往https://blog.guillaume-gomez.fr/articles/2020-01-06+New+sysinfo+release+(OSX+performance+improvements) 查看更新日志。
restq-一种适用于rest api的紧凑型查询语言
/person?age=lt.42&(student=eq.true|gender=eq.'M')&group_by=sum(age),grade,gender&having=min(age)=gt.42&order_by=age.desc,height.asc&page=20&page_size=100
大致转换成sql即为:
SELECT * FROM person
WHERE age < 42
AND (student = true OR gender = 'M')
GROUP BY sum(age), grade, gender
HAVING min(age) > 42
ORDER BY age DESC, height ASC
LIMIT 100 OFFSET 1900 ROWS
RestQ的语句/语法
create = table, column_def_list, "\n", csv
select = table, [join_table], column_list, [ "?", condition]
delete = table, [ "?", condition ]
update = table, set_expr_list, [ "?", condition]
drop = "-", table
alter = table, { drop_column | add_column | alter_column }
drop_column = "-", column
add_column = "+", column_def
alter_column = column, "=", column_def
column_def_list = "{", { column_def }, "}"
| "(", { column_def }, ")"
column_def = [ { column_attributes } ], column, [ "(" foreign ")" ], ":", data_type, [ "(" default_value ")" ]
column_attributes = primary | index | unique
primary = "*"
index = "@"
unique = "&"
data_type = "bool" | "s8" | "s16" | "s32" | "s64" | "u8" | "u16", etc
default_value = value
value = number | string | bool ,..etc
column = string, ".", string
| string
table = string
foreign = table
insert = table, column_list ,"\n", csv
column_list = "{", { column }, "}"
| "(", { column }, ")"
join_table = table, join_type, table
join_type = right_join | left_join | inner_join | full_join
right_join = "->" | "-^"
left_join = "<-" | "^-"
inner_join = "-><-" | "-^^-"
full_join = "<-->" | "^--^"
condition = expr
expr = column | value | binary_operation
binary_operation = expr, operator, expr
operator = "and" | "or" | "eq" | "gte" | "lte" ,..etc
更多详细功能与用法前往GitHub查看。
From 日报小组 @Lance
文章评论