New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 839091 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature

Blocked on:
issue 841482



Sign in to add a comment

[Feature] TaskScheduler Jobs API

Project Member Reported by gab@chromium.org, May 2 2018

Issue description

This would help make V8 GC and compile's use case (e.g. https://cs.chromium.org/chromium/src/v8/src/heap/item-parallel-job.h) main stream.

This use case is currently being backported to Oilpan.

Currently people that want to use TaskScheduler workers to churn through a list of work items have to post a task, steal the worker when scheduled and loop until the list of work items is empty.

This removes the ability of TaskScheduler to preempt such work when more important work comes in, e.g. preventing cases like this (V8 compile prevents V8 GC from using all cores while it's blocking the main thread): https://docs.google.com/presentation/d/1Ve-XvW4IDH60VRdukaU6FdD-j1ccEZZj64rSqgROhR4/edit#slide=id.g389d99bb77_0_11

Churning through work items in parallel while blocking the object's owning sequence is an interesting paradigm. But it's currently very hard to implement and as such is only done in V8 in scenarios where it's absolutely performance critical.

Tentative API proposal:

// Will most often repeatedly invoke |process_work_item| concurrently on as many workers as are sensible for |traits| but may preempt execution on any/all workers at any given point in time should something more important be posted.
base::PostJobWithTraits(const Location&, TaskTraits traits, const base::RepeatingCallback<bool(void)> process_work_item);

Note: May want to consider a delegate instead of a RepeatingCallback if going through Callback::Run() is too expensive in a tight loop.
 

Comment 1 by gab@chromium.org, May 9 2018

Blockedon: 841482

Sign in to add a comment