New issue
Advanced search Search tips

Issue 669247 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 553459



Sign in to add a comment

Add TaskTraits::WithWait().

Project Member Reported by fdoray@chromium.org, Nov 28 2016

Issue description

1. Add TaskTraits::WithWait().
WithWait() tasks are allowed to wait on other things than file I/O. In
particular, they may wait on a WaitableEvent or a ConditionVariable, join a
thread or a process, or make a blocking system call that doesn't involve
interactions with the file system.

2. Update the mapping function in Chrome
https://cs.chromium.org/chromium/src/components/task_scheduler_util/initialization_util.cc?l=94 so that WithWait() tasks run in the same pool as WithFileIO() tasks. That way, a task that waits for a long time (e.g. https://cs.chromium.org/chromium/src/chrome/browser/component_updater/recovery_component_installer.cc?l=148) won't prevent short CPU tasks from being scheduled.

3. Add logic to create a new thread when a WithWait() task takes too much time to run. E.g. A pool has max_threads = 3. It starts running a WithWait() task. If the WithWait() task is still running after a timeout, the task is considered to be blocked. The pool will schedule tasks on a 4th thread until the task completes.

Note: The heuristic described in (2) works on all platforms. On Windows and Mac, we have plans to replace it with calls to OS APIs that tell us whether tasks are really blocked.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/19509c12031a760169479b34fe6408a093b71900

commit 19509c12031a760169479b34fe6408a093b71900
Author: fdoray <fdoray@chromium.org>
Date: Tue Nov 29 19:45:01 2016

TaskScheduler: Add TaskTraits::WithWait().

WithWait() tasks are allowed to wait on other things than file I/O. In
particular, they may wait on a WaitableEvent or a ConditionVariable, join a
thread or a process, or make a blocking system call that doesn't involve
interactions with the file system.

In upcoming CLs, this trait will be used in scheduling decisions (more
details on the bug).

BUG= 669247 

Review-Url: https://codereview.chromium.org/2531663003
Cr-Commit-Position: refs/heads/master@{#435054}

[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/task_scheduler/task_tracker.cc
[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/task_scheduler/task_tracker_unittest.cc
[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/task_scheduler/task_traits.cc
[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/task_scheduler/task_traits.h
[modify] https://crrev.com/19509c12031a760169479b34fe6408a093b71900/base/threading/sequenced_worker_pool.cc

Comment 2 Deleted

Status: Fixed (was: Done)

Sign in to add a comment