Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

公用栈支持分组? #8

Open
skywind3000 opened this issue Dec 27, 2017 · 4 comments
Open

公用栈支持分组? #8

skywind3000 opened this issue Dec 27, 2017 · 4 comments

Comments

@skywind3000
Copy link

比如一个 schedule 里面有 100个 stack,每个 2MB,一共 200MB,每个栈,管理一组 coroutine
假设有 5000个 coroutine ,平均分布在 100组栈上,每组栈 50个 coroutine。

coroutine 被切走的时候,并不会马上拷贝栈,而会保留在那一个栈上,直到同一组的 coroutine 需要resume,才会把之前 on-stack 的 coroutine 拷贝走。

这样每个 stack 上保留的 coroutine 都是最近最活跃的 coroutine,栈拷贝的次数下降100倍。

@Yuandong-Chen
Copy link

Yuandong-Chen commented May 7, 2018

@skywind3000 不如直接提个要求,造C语言的,优雅的Actor库更加实在。我肯定会直接选择erlang/elixir,或者java/akka。

@qingdujun
Copy link

这样需要额外的分组消耗;还需要记录当前没被切走的栈是谁的栈。

@skywind3000
Copy link
Author

这个记录比拷贝栈轻量级多了。

@Prince-Hervoet
Copy link

给每一个routine数据结构中加一个groupId?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants