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

Improve processor parking strategy #27

Open
zonyitoo opened this issue Jan 30, 2016 · 3 comments
Open

Improve processor parking strategy #27

zonyitoo opened this issue Jan 30, 2016 · 3 comments
Assignees

Comments

@zonyitoo
Copy link
Owner

Right now Processors will wait forever in its own channel until got notified by ProcMessage. So it won't try to steal jobs from the other Processors!

So we have to add something to achieve:

  1. Processor won't spin itself when it has nothing to do.
  2. Processor can process the ProcMessages in time.
  3. Processor can steal jobs from the other Processors.

Please add comments below :)

@zonyitoo zonyitoo changed the title Improve processor packing strategy Improve processor parking strategy Jan 30, 2016
@lhecker
Copy link
Collaborator

lhecker commented Jan 30, 2016

We might want to thread::park()/unpark() the current thread and add it's handle to a processor wait list on the Scheduler...

This thread would get unparked whenever Scheduler::ready() is called with a preferred_processor which is the currently parked processor, or when a Processor determines that it has a big amount (>N) of coroutines in it's deque and would like to have some help by another Processor.

Well something like that I guess should solve this...
But I'm quite sure that the Processors have to have a certain level of "cooperation".

@zonyitoo
Copy link
Owner Author

But every time the ready() is called, you would have to check the parked list and wake one thread up. Please try to implement it and do a simple benchmarking on it.

@zonyitoo
Copy link
Owner Author

Ah, I accidentally merged this branch to master by hand. My fault. We could keep on discussing in the issue.

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

No branches or pull requests

2 participants