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

https://yyu-nim.github.io/crossbeam/rust/2022/07/21/crossbeam-workstealing-2.html #5

Open
utterances-bot opened this issue Aug 1, 2022 · 3 comments

Comments

@utterances-bot
Copy link

Crossbeam work-stealing queue <2> | Your awesome title

100만개의 일을 만들어서, 10개의 worker들에게 나눠주기. 방식은 work-stealing으로 worker들이 일을 빼앗아 감. ```rust use std::thread; use std::time::Duration; use crossbeam::deque::{Steal, Worker};

https://yyu-nim.github.io/crossbeam/rust/2022/07/21/crossbeam-workstealing-2.html

Copy link

tokio blog를 보다가 이 블로그글이 생각나 돌아왔습니다 ㅎㅎ

제 컴퓨터에서 돌려보면 항상 worker 0 이 모든 일을 다 하고 있었는데요,
worker::Steal() 을 동시에 여러 thread가 시도하면서 실패하는 경우가 있는 것 같아요.
Steal::Retry 시에는 continue, Steal::Empty 시에만 break하도록 수정하니 task가 여러 thread에 골고루 분배되었습니다!

Copy link
Owner

yyu-nim commented Aug 1, 2022

그게 문제였나 보네요! 테스트 해보고 반영하도록 하겠습니다 ㅎ 감사합니다!

Copy link
Owner

yyu-nim commented Aug 1, 2022

아주 잘 되네요!! worker 간에 work들이 균등하게 잘 배분되는 것 같습니다.

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

3 participants