Improve processor parking strategy
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:
Processorwon't spin itself when it has nothing to do.Processorcan process theProcMessages in time.Processorcan steal jobs from the otherProcessors.
Please add comments below :)
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".
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.
Ah, I accidentally merged this branch to master by hand. My fault. We could keep on discussing in the issue.