HiI just discussed what tasks should use what task runners in the world of the per-frame scheduler with Sami and Alex.Here is a summary of what we discussed:- Per-frame scheduler--- Specific task runners (<= encouraged)------ Idle task runner------ Timer task runner------ Loading task runner------ Rendering task runner------ Input task runner
------ ...--- Default task runner (<= not encouraged)
--- Unthrottled task runner (<= highly not encouraged)- Per-thread scheduler--- Idle task runner (<= not encouraged)--- Default task runner (<= not encouraged)The key points are as follows:- We should use the per-frame scheduler as much as possible. The per-thread scheduler is not encouraged.- We should use the specific task runners as much as possible (we can introduce more specific task runners as necessary). The default task runner is not encouraged.- Regarding the per-frame scheduler, the specific task runners and the default task runner may be throttled on offscreen iframes. The unthrottled task runner can be used for tasks that shouldn't be throttled but the use case should be limited.Does the above guideline make sense?We need to convert 70 timers, 36 same-thread tasks and some of 54 cross-thread tasks posted to the main thread.--Kentaro Hara, Tokyo, Japan
--
You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architect...@chromium.org.
To post to this group, send email to platform-arc...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CABg10jy9b2z5BVYqV_YMHjo%2B4eVaqz0LrShaGnb_HhPbz22%2BRQ%40mail.gmail.com.
On Tue, Jul 26, 2016 at 6:28 AM Kentaro Hara <har...@chromium.org> wrote:HiI just discussed what tasks should use what task runners in the world of the per-frame scheduler with Sami and Alex.Here is a summary of what we discussed:- Per-frame scheduler--- Specific task runners (<= encouraged)------ Idle task runner------ Timer task runner------ Loading task runner------ Rendering task runner------ Input task runnerWhat's the difference between the input task runner and the rendering task runner? The benefit of having different task runners is that we can schedule them separately, right? When would we want to schedule rendering and input tasks separately?It would help to understand this if you had a couple examples of what would go in each of these task runners. If you don't know right now, I would say we should avoid having that task runner until we prove the need for it with specific examples.
------ ...--- Default task runner (<= not encouraged)Maybe we should avoid having the default task runner at all until we prove we need it for something. The problem with default is that it's where people will naturally put new ones and we'd have to catch it in codereview, which is always hard.
----- Unthrottled task runner (<= highly not encouraged)- Per-thread scheduler--- Idle task runner (<= not encouraged)--- Default task runner (<= not encouraged)The key points are as follows:- We should use the per-frame scheduler as much as possible. The per-thread scheduler is not encouraged.- We should use the specific task runners as much as possible (we can introduce more specific task runners as necessary). The default task runner is not encouraged.- Regarding the per-frame scheduler, the specific task runners and the default task runner may be throttled on offscreen iframes. The unthrottled task runner can be used for tasks that shouldn't be throttled but the use case should be limited.Does the above guideline make sense?We need to convert 70 timers, 36 same-thread tasks and some of 54 cross-thread tasks posted to the main thread.--Kentaro Hara, Tokyo, Japan
You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architect...@chromium.org.
To post to this group, send email to platform-arc...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CABg10jy9b2z5BVYqV_YMHjo%2B4eVaqz0LrShaGnb_HhPbz22%2BRQ%40mail.gmail.com.
Incidentally, I'd like to split blink::Timer into two subclasses:- blink::LegacyTimer (I can't really think of a good name for this, suggestions welcome): this just defaults to using Platform::current()->currentThread()->scheduler()->timerTaskRunner() as the task runner, so it's basically the current blink::Timer. Eventually, maybe we can remove this completely, but I'm not sure if we should: it seems like it might be convenient as a way to encourage people to use a blink::Timer with the appropriate task runner instead (and provides an easy way to grep for timers running on the default task queues).- blink::Timer: like the current blink::Timer, but also takes a required TaskRunner argument (that should not be whatever LegacyTimer defaults to, we can DCHECK this)In addition, this will help track the progress of the conversion. Thoughts?
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CABg10jwXbP3WeeOH5LzqK9ZOs-aBqENCt67hhO%3DPQOC6GhVeuA%40mail.gmail.com.
Or you could introduce IdleTimer, LoadingTimer, RenderingTimer etc as sub-classes of Timer. (I don't have any strong opinion.)
On Wed, Jul 27, 2016 at 9:39 AM, Kentaro Hara <har...@chromium.org> wrote:On Wed, Jul 27, 2016 at 9:31 AM, Daniel Cheng <dch...@chromium.org> wrote:Incidentally, I'd like to split blink::Timer into two subclasses:- blink::LegacyTimer (I can't really think of a good name for this, suggestions welcome): this just defaults to using Platform::current()->currentThread()->scheduler()->timerTaskRunner() as the task runner, so it's basically the current blink::Timer. Eventually, maybe we can remove this completely, but I'm not sure if we should: it seems like it might be convenient as a way to encourage people to use a blink::Timer with the appropriate task runner instead (and provides an easy way to grep for timers running on the default task queues).- blink::Timer: like the current blink::Timer, but also takes a required TaskRunner argument (that should not be whatever LegacyTimer defaults to, we can DCHECK this)In addition, this will help track the progress of the conversion. Thoughts?Sounds like a nice plan! Timers provide convenient functionalities like cancel(), stop(), startOneShot() etc, so we want to keep them.Instead of introducing the LegacyTimer, we might want to provide two versions of constructors: One that takes the TaskRunner parameter, and the other that doesn't take the TaskRunner parameter (which should be deprecated).
On Wed, Jul 27, 2016 at 4:41 PM Kentaro Hara <har...@chromium.org> wrote:Or you could introduce IdleTimer, LoadingTimer, RenderingTimer etc as sub-classes of Timer. (I don't have any strong opinion.)I like this idea, but I think that we would need to put these subclasses in core/dom (so it can grab the corresponding timer from the LocalFrame). Does that sound reasonable? I still think we should give the default Timer class a longer name either way, so it doesn't become the go-to Timer class anyway because of it's short name =)
On Wed, Jul 27, 2016 at 9:39 AM, Kentaro Hara <har...@chromium.org> wrote:On Wed, Jul 27, 2016 at 9:31 AM, Daniel Cheng <dch...@chromium.org> wrote:Incidentally, I'd like to split blink::Timer into two subclasses:- blink::LegacyTimer (I can't really think of a good name for this, suggestions welcome): this just defaults to using Platform::current()->currentThread()->scheduler()->timerTaskRunner() as the task runner, so it's basically the current blink::Timer. Eventually, maybe we can remove this completely, but I'm not sure if we should: it seems like it might be convenient as a way to encourage people to use a blink::Timer with the appropriate task runner instead (and provides an easy way to grep for timers running on the default task queues).- blink::Timer: like the current blink::Timer, but also takes a required TaskRunner argument (that should not be whatever LegacyTimer defaults to, we can DCHECK this)In addition, this will help track the progress of the conversion. Thoughts?Sounds like a nice plan! Timers provide convenient functionalities like cancel(), stop(), startOneShot() etc, so we want to keep them.Instead of introducing the LegacyTimer, we might want to provide two versions of constructors: One that takes the TaskRunner parameter, and the other that doesn't take the TaskRunner parameter (which should be deprecated).This is my current approach but it's harder to track progress this way: I need to check codesearch for Timers to update, and the codesearch index is not updated in real time.
btw, v8 uses whatever base::ThreadTaskRunnerHandler::Get() returns at Isolate creation time for foreground tasks and idle tasks, and base::WorkerPool for background tasks.
It would be nice if we could replace base::WorkerPool with something a bit smarter in the future.
On Tue, Jul 26, 2016 at 11:25 PM, Ojan Vafai <oj...@chromium.org> wrote:On Tue, Jul 26, 2016 at 6:28 AM Kentaro Hara <har...@chromium.org> wrote:HiI just discussed what tasks should use what task runners in the world of the per-frame scheduler with Sami and Alex.Here is a summary of what we discussed:- Per-frame scheduler--- Specific task runners (<= encouraged)------ Idle task runner------ Timer task runner------ Loading task runner------ Rendering task runner------ Input task runnerWhat's the difference between the input task runner and the rendering task runner? The benefit of having different task runners is that we can schedule them separately, right? When would we want to schedule rendering and input tasks separately?It would help to understand this if you had a couple examples of what would go in each of these task runners. If you don't know right now, I would say we should avoid having that task runner until we prove the need for it with specific examples.Sami?
------ ...--- Default task runner (<= not encouraged)Maybe we should avoid having the default task runner at all until we prove we need it for something. The problem with default is that it's where people will naturally put new ones and we'd have to catch it in codereview, which is always hard.Yeah, it might be better not to introduce the default task runner than discouraging people from using it. I wanted to introduce the default task runner for WTF::Timers because WTF::Timers are used for many implementation hacks (e.g., delay destructors) and it's sometimes hard to associate the WTF::Timers with specific task runners. Maybe we can use the idle task runner for common WTF::Timers.
--- Unthrottled task runner (<= highly not encouraged)- Per-thread scheduler--- Idle task runner (<= not encouraged)--- Default task runner (<= not encouraged)The key points are as follows:- We should use the per-frame scheduler as much as possible. The per-thread scheduler is not encouraged.- We should use the specific task runners as much as possible (we can introduce more specific task runners as necessary). The default task runner is not encouraged.- Regarding the per-frame scheduler, the specific task runners and the default task runner may be throttled on offscreen iframes. The unthrottled task runner can be used for tasks that shouldn't be throttled but the use case should be limited.Does the above guideline make sense?We need to convert 70 timers, 36 same-thread tasks and some of 54 cross-thread tasks posted to the main thread.--Kentaro Hara, Tokyo, Japan
What's the advantage of using CancellableTaskFactory over Timer?
There're only 10 users of startRepeating(). But there're a lot of users of isActive().
At a high-level, lgtm. But, I want to repeat that the most helpful thing in understanding/evaluating this proposal is to have a couple examples of things that would go in each of these queues.Just to give a bit of color here to what I was saying. I'm a bit worried that as we add all these task runners it will be very hard for chrome devs to reason about which task runner they should put their task in and that we'll need to rely on experts to review every patch that adds a new task. So, the simpler we can keep things the better. If we get concrete wins from creating a new task runner, then I think it's worth it. But, I'd err on the side of not adding speculative ones.
On Thu, Jul 28, 2016 at 8:58 PM, Ojan Vafai <oj...@chromium.org> wrote:At a high-level, lgtm. But, I want to repeat that the most helpful thing in understanding/evaluating this proposal is to have a couple examples of things that would go in each of these queues.Just to give a bit of color here to what I was saying. I'm a bit worried that as we add all these task runners it will be very hard for chrome devs to reason about which task runner they should put their task in and that we'll need to rely on experts to review every patch that adds a new task. So, the simpler we can keep things the better. If we get concrete wins from creating a new task runner, then I think it's worth it. But, I'd err on the side of not adding speculative ones.I understand your concern. However, if we want to avoid adding a new task runner until we're confident that it's needed, we'll need the default task runner. For example, if we only have Idle, Loading and Timer task runners, it's not clear where HTMLCanvasElement's tasks should go. In other words, if we want to avoid the default task runner, we cannot avoid adding a couple of specific task runners speculatively, I guess.
At a high-level, lgtm. But, I want to repeat that the most helpful thing in understanding/evaluating this proposal is to have a couple examples of things that would go in each of these queues.Just to give a bit of color here to what I was saying. I'm a bit worried that as we add all these task runners it will be very hard for chrome devs to reason about which task runner they should put their task in and that we'll need to rely on experts to review every patch that adds a new task. So, the simpler we can keep things the better. If we get concrete wins from creating a new task runner, then I think it's worth it. But, I'd err on the side of not adding speculative ones.
I'm also a bit confused about how using different task runners doesn't affect task running order. If you throttle one task runner, but not another, then the order of the tasks relative to each other changes, right? Am I misunderstanding how the system works? The end result would be that you can't assume a consistent interleaving of rendering and input events if we had different task runners for them, which I think would probably not be what we want. But again, I'm making theoretical/conceptual arguments here. It will be easier to reason about when we actually have lists of tasks that would go in each task runner.
Also, yay! Can't wait for this work to complete. It's gonna be great. :)
to 28. heinäkuuta 2016 klo 19.58 Ojan Vafai <oj...@chromium.org> kirjoitti:At a high-level, lgtm. But, I want to repeat that the most helpful thing in understanding/evaluating this proposal is to have a couple examples of things that would go in each of these queues.Just to give a bit of color here to what I was saying. I'm a bit worried that as we add all these task runners it will be very hard for chrome devs to reason about which task runner they should put their task in and that we'll need to rely on experts to review every patch that adds a new task. So, the simpler we can keep things the better. If we get concrete wins from creating a new task runner, then I think it's worth it. But, I'd err on the side of not adding speculative ones.I agree that developer ergonomics is a big factor here.I'm also a bit confused about how using different task runners doesn't affect task running order. If you throttle one task runner, but not another, then the order of the tasks relative to each other changes, right? Am I misunderstanding how the system works? The end result would be that you can't assume a consistent interleaving of rendering and input events if we had different task runners for them, which I think would probably not be what we want. But again, I'm making theoretical/conceptual arguments here. It will be easier to reason about when we actually have lists of tasks that would go in each task runner.Right, if you prioritize task runners differently then they will no longer run tasks in order. If you prioritize a bunch of task runners as a unit, then task ordering will be preserved -- but I admit that is somewhat of a fragile setup and we should only do it if it has other clear benefits.
On Fri, Jul 29, 2016 at 12:48 PM, Sami Kyostila <skyo...@google.com> wrote:to 28. heinäkuuta 2016 klo 19.58 Ojan Vafai <oj...@chromium.org> kirjoitti:At a high-level, lgtm. But, I want to repeat that the most helpful thing in understanding/evaluating this proposal is to have a couple examples of things that would go in each of these queues.Just to give a bit of color here to what I was saying. I'm a bit worried that as we add all these task runners it will be very hard for chrome devs to reason about which task runner they should put their task in and that we'll need to rely on experts to review every patch that adds a new task. So, the simpler we can keep things the better. If we get concrete wins from creating a new task runner, then I think it's worth it. But, I'd err on the side of not adding speculative ones.I agree that developer ergonomics is a big factor here.I'm also a bit confused about how using different task runners doesn't affect task running order. If you throttle one task runner, but not another, then the order of the tasks relative to each other changes, right? Am I misunderstanding how the system works? The end result would be that you can't assume a consistent interleaving of rendering and input events if we had different task runners for them, which I think would probably not be what we want. But again, I'm making theoretical/conceptual arguments here. It will be easier to reason about when we actually have lists of tasks that would go in each task runner.Right, if you prioritize task runners differently then they will no longer run tasks in order. If you prioritize a bunch of task runners as a unit, then task ordering will be preserved -- but I admit that is somewhat of a fragile setup and we should only do it if it has other clear benefits.I'm just curious but today is it guaranteed that tasks posted by Blink are fired in the posted order (even if the tasks go to different task runners)?
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CAPG_qM6f-26gUyWQm3uA9ABOgXbvt0gb3MPwzjzkvmMWRO97LQ%40mail.gmail.com.
To expand on that, for example timer tasks are not guaranteed to run in the same order as unthrottled tasks.
On Fri, Jul 29, 2016 at 1:30 PM, Sami Kyostila <skyo...@google.com> wrote:To expand on that, for example timer tasks are not guaranteed to run in the same order as unthrottled tasks.Yeah, that's why I asked the question. Even if we don't throttle any task runner, we're already breaking the task ordering by having multiple task runners.
The per-frame scheduler will make the breakage a bit worse by introducing more task runners. But my understanding is that it would be okay because the ordering wouldn't really matter in practice. Am I understanding things correctly?
Today Elliott, Ojan and I discussed in an arch-leads meeting what task ordering is guaranteed today and how the per-frame scheduler is going to break it. I'm not intending to rely on the priorities; just wanted to clarify :)I'm confused.In the above of this thread, you were saying:>> Yeah, that's why I asked the question. Even if we don't throttle any task runner, we're already breaking the task ordering by having multiple task runners.>>> That's not true: distinct task runners with equal priority (and time domain) will always run tasks in posted order.but now you're saying:> In general we shouldn't assume any ordering between different task runners. Otherwise we tie our hands from actually setting different priorities for different task runners and the whole thing becomes kind of pointless :)
>
> Right now in your list the default, loading and unthrottled task runners run in order w.r.t. one another, but timers may run out of order. But to reiterate, let's not rely on this.
virtual void SetQueueEnabled(bool enabled) = 0;
And each task queue has a priority: enum QueuePriority { CONTROL_PRIORITY, -- Highest priority, for internal use only, will starve out other work HIGH_PRIORITY, -- For every 5 high priority tasks, one lower priority one will run NORMAL_PRIORITY, BEST_EFFORT_PRIORITY, -- Only runs if there's no other work to do }
virtual void SetQueuePriority(QueuePriority priority) = 0;
When selecting which task to run next, the scheduler uses this algorithm:- Run any CONTROL_PRIORITY tasks
- If starvation counter < 5 then run any HIGH_PRIORITY tasks and increment starvation counter
- Run any NORMAL_PRIORITY tasks and set starvation counter to zero
- Run any BEST_EFFORT_PRIORITY tasks and set starvation counter to zero
To make that fast, for each priority the scheduler maintains a map of queueing order to task queues. The queueing order is a 64 bit int set whenevera task becomes ready to run (e.g. when you PostTask or when the delay has expired for a PostDelayedTask) and the smaller the number the older thetask is.
If there is more than one task queue with a given priority, the one with the lowest queueing order is selected. This is why we say that if there are severaltask queues with the same priority tasks will run in the order they are posted in.
Most scheduling decisions are implemented by manipulating the priority of compositor_task_queue, and temporarily enabling or disabling other queues.
By doing so we change the order in which tasks get run, and we have to be very careful about that or we risk breaking people's expectations.
Some notes:- The loading_tq can't be prioritized over the default_tq or IPC code starts to break.
- The loading_tq can often be throttled without ill effect (bar increased loading times).
- The timer_tq can often be throttled without ill effect (bar lower timer throughput).
- The compositor_tq can safely have any priority - although getting it wrong causes jank
- Generally the loading_tq, timer_tq and default_tq all have NORMAL_PRIORITY
In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?
Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be risky
On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CAPG_qM7eGRev_MbuKbyNRFOKQ1nQmT%2B5ErXRNVVErTt7WkkFQA%40mail.gmail.com.
On Tue, Aug 2, 2016 at 11:34 PM, 'Alex Clarke' via platform-architecture-dev <platform-arc...@chromium.org> wrote:On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.Hmm. But what still confuses me is that it sounds like "You must not assume that tasks in distinct task runners are orderly executed. However, regarding task runners that you know have the same priority, you can assume that the tasks are orderly executed".
On 2 August 2016 at 16:25, Kentaro Hara <har...@chromium.org> wrote:On Tue, Aug 2, 2016 at 11:34 PM, 'Alex Clarke' via platform-architecture-dev <platform-arc...@chromium.org> wrote:On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.Hmm. But what still confuses me is that it sounds like "You must not assume that tasks in distinct task runners are orderly executed. However, regarding task runners that you know have the same priority, you can assume that the tasks are orderly executed".Does thinking like this help?If tasks 1, 2, & 3 must run in order then they must be posted on the same task queue.If tasks 1, 2, & 3 are unrelated it doesn't matter which task queue they are posted on, although they will often run in order.
On Wed, Aug 3, 2016 at 12:34 AM, Alex Clarke <alexc...@google.com> wrote:On 2 August 2016 at 16:25, Kentaro Hara <har...@chromium.org> wrote:On Tue, Aug 2, 2016 at 11:34 PM, 'Alex Clarke' via platform-architecture-dev <platform-arc...@chromium.org> wrote:On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.Hmm. But what still confuses me is that it sounds like "You must not assume that tasks in distinct task runners are orderly executed. However, regarding task runners that you know have the same priority, you can assume that the tasks are orderly executed".Does thinking like this help?If tasks 1, 2, & 3 must run in order then they must be posted on the same task queue.If tasks 1, 2, & 3 are unrelated it doesn't matter which task queue they are posted on, although they will often run in order.Yes, I like this rule. But if we follow the rule, having more task runners has a risk of violating necessary task ordering, right?
(Or, as the number of task runners increases, the complexity of considering what tasks should go to what task runners increases.)
That's why I'm thinking that it would make more sense to post as many tasks to one specific task runner (e.g., Timer task runner) as possible instead of introducing Rendering task runner, Worker task runner etc until we really want to have a different scheduling policy.
On 2 August 2016 at 16:44, Kentaro Hara <har...@chromium.org> wrote:On Wed, Aug 3, 2016 at 12:34 AM, Alex Clarke <alexc...@google.com> wrote:On 2 August 2016 at 16:25, Kentaro Hara <har...@chromium.org> wrote:On Tue, Aug 2, 2016 at 11:34 PM, 'Alex Clarke' via platform-architecture-dev <platform-arc...@chromium.org> wrote:On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.Hmm. But what still confuses me is that it sounds like "You must not assume that tasks in distinct task runners are orderly executed. However, regarding task runners that you know have the same priority, you can assume that the tasks are orderly executed".Does thinking like this help?If tasks 1, 2, & 3 must run in order then they must be posted on the same task queue.If tasks 1, 2, & 3 are unrelated it doesn't matter which task queue they are posted on, although they will often run in order.Yes, I like this rule. But if we follow the rule, having more task runners has a risk of violating necessary task ordering, right?(Or, as the number of task runners increases, the complexity of considering what tasks should go to what task runners increases.)That's why I'm thinking that it would make more sense to post as many tasks to one specific task runner (e.g., Timer task runner) as possible instead of introducing Rendering task runner, Worker task runner etc until we really want to have a different scheduling policy.I think I see what you mean, and it might be the right call to avoid adding new task runners unless we intend to for them to have different scheduling policies.
On Wed, Aug 3, 2016 at 12:55 AM, Alex Clarke <alexc...@google.com> wrote:On 2 August 2016 at 16:44, Kentaro Hara <har...@chromium.org> wrote:On Wed, Aug 3, 2016 at 12:34 AM, Alex Clarke <alexc...@google.com> wrote:On 2 August 2016 at 16:25, Kentaro Hara <har...@chromium.org> wrote:On Tue, Aug 2, 2016 at 11:34 PM, 'Alex Clarke' via platform-architecture-dev <platform-arc...@chromium.org> wrote:On 2 August 2016 at 15:20, Kentaro Hara <har...@chromium.org> wrote:Thanks a lot for the details, Alex and Sami!In my defense both are technically true :) Just adding another task runner doesn't cause things to run out of order, but as soon as someone sets a different priority on that task runner (e.g., just by disabling it), the global task ordering will change. That's why I think as we move things to distinct task runners, we should assume that they can run out of order w.r.t. other task runners. Does that make sense?The idea of the per-frame scheduler is, in the first place, that we want to deprioritize tasks in some task runners of third-party iframes. This means that we *must not* assume that tasks in distinct task runners are ordered, even if the distinct task runners happen to have the same priority. Am I understanding correctly?If that is the case, I begin to think that it would be riskyThat depends what you do with them :)Introducing a new task runner which inherits the settings from another task queue for FrameBlamr isn't inherently risky because this isn't changing the order of execution.If we want to introduce something new (and the spec gives us some latitude to do this) and change it's priority, that is risky. Stuff will break, but fixing that might be worth it should be benefit be significant.Hmm. But what still confuses me is that it sounds like "You must not assume that tasks in distinct task runners are orderly executed. However, regarding task runners that you know have the same priority, you can assume that the tasks are orderly executed".Does thinking like this help?If tasks 1, 2, & 3 must run in order then they must be posted on the same task queue.If tasks 1, 2, & 3 are unrelated it doesn't matter which task queue they are posted on, although they will often run in order.Yes, I like this rule. But if we follow the rule, having more task runners has a risk of violating necessary task ordering, right?(Or, as the number of task runners increases, the complexity of considering what tasks should go to what task runners increases.)That's why I'm thinking that it would make more sense to post as many tasks to one specific task runner (e.g., Timer task runner) as possible instead of introducing Rendering task runner, Worker task runner etc until we really want to have a different scheduling policy.I think I see what you mean, and it might be the right call to avoid adding new task runners unless we intend to for them to have different scheduling policies.If that's the way to go, would it be a right thing to use the Timer task runner to post tasks that aren't related to loading or unthrottled?
There's actually a dedicated timer task runner in the spec so I think we can keep that. It might be worth grepping to see what others are there -- the link I posted earlier only lists the generic ones.
It *seems* like it should be safe to throttle all of the task runners you listed aside from the unthrottled one.
Oh, I see. I misunderstood the proposal. With b, there's some compatibility risk if we were to separately throttle the task runners. In theory it should be OK, but I think it's extremely unlikely that the spec matches real-world web compatibility since that's not what any browser implements AFAIK.
Oh, I see. I misunderstood the proposal. With b, there's some compatibility risk if we were to separately throttle the task runners. In theory it should be OK, but I think it's extremely unlikely that the spec matches real-world web compatibility since that's not what any browser implements AFAIK.Sorry for not being clear. I'm planning to mitigate the compatibility risk as follows:1) When Blink posts tasks/timers, use TaskType::XXX as conformant to the spec as possible (instead of using TaskType::Timer unconditionally).2) The TaskType::XXX is mapped to the underlying task runners (timer/loading/unthrottled). The mapping is encapsulated in TaskRunnerHelper::get(). At the moment, almost all TaskTypes are mapped to the timer task runner (and I think this is what you want :) At this point we don't need to worry about compatibility too much. This is the per-frame scheduler project.3) In middle term, we want to introduce more task runners and throttle some of them. At that point, we can just adjust the mapping in TaskRunnerHelper::get(). At this point we need to worry about compatibility.Does it make sense?