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

preemptive scheduling #5731

Closed
thestinger opened this issue Apr 5, 2013 · 3 comments
Closed

preemptive scheduling #5731

thestinger opened this issue Apr 5, 2013 · 3 comments
Labels
A-concurrency Area: Concurrency E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.

Comments

@thestinger
Copy link
Contributor

I'm sure this would be very hard to implement and wouldn't be a good thing for all Rust code, but it is possible so I'm opening up an issue as a reference. I don't think having the compiler automatically insert yields into most loops would ever be an acceptable performance hit, so this is another alternative.

In a world without preemption, you can avoid blocking other tasks by assigning threads to tasks with CPU-bound loops or manually inserting scheduler yields. The garbage collector is task-local, so it's not going to be as big of an issue as it is in Go where one task can block garbage collection for the entire process.

@brson
Copy link
Contributor

brson commented Apr 5, 2013

One alternate thing we can do if you want fairer scheduling is to run in a not-yet-implemented thread-per-task (or maybe more like scheduler-per-task) mode. It would cost some in context switching but you would get much better scheduling.

Additionally, we should be able to execute the schedulers themselves on segmented stacks. On Linux at least this would likely perform and scale amazingly well.

@graydon
Copy link
Contributor

graydon commented Apr 25, 2013

dupe of #3095 in the sense that "if we have work stealing and we always keep a spare thread around, we can let OS thread-preemption handle these cases by stealing all the work that would otherwise be starved".

@graydon graydon closed this as completed Apr 25, 2013
@thestinger
Copy link
Contributor Author

@graydon: Yeah, I don't think is worth implementing in a userland scheduler. If preemptive scheduling is wanted, it would be better to just use OS threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot.
Projects
None yet
Development

No branches or pull requests

3 participants