On 10/12/2013 05:01 PM, Lars Bergstrom wrote:
This was a great example and great find! After talking with Brian, I've opened 
Rust issue 9831 (https://github.com/mozilla/rust/issues/9831 ) to track the 
scheduler changes to make this code work.

What we can do in Servo right now is to start from a normal task instead and 
spawn the constellation from there, spawning the special compositor thread 
separately (instead of as the root task). We believe that should work around 
the problem.

The compositor should still be the root task as that's the only way to get onto the main thread, but from there you can create another task which will begin execution on one of the normal schedulers, and from that task spawn all the others, which will then be distributed to other schedulers.

The problem here (I think) has to do with how single-threaded schedulers (including the main thread) unload work they can't do (which in these tests include all the subtasks). Single-threaded schedulers have a 'friend' scheduler to which they send tasks that can't be run locally. This causes execution of those tasks to be serialized through the friend scheduler up to the point they send or receive a message. By first executing just a single task on a normal work-stealing scheduler and spawning from there, workstealing should kick in immediately for all the subtasks.


The reason we get any parallelism with code running inside an iframe is that 
the task creation stuff I added to handle supervision and unlink failure also 
caused those to get run on a separate scheduler instead of blocking inside of 
the root scheduler associated with the main task.


On Oct 11, 2013, at 11:58 PM, Ilyong Cho <ily...@gmail.com> wrote:

FWIW The benchmark that I've done shows that there is no performance win by
spawning multiple tasks when top level task was started by
`start_on_main_thread()`:
https://gist.github.com/ILyoan/6945608

The output of the test implies spawning multi tasks from top level task
started on main thread doesn't exploits multi cores, but normal started
test shows performance improvement.

Not sure but I tentatively belive that similar phenomena arise on servo as
well.

Thanks,
Ilyong
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to