这是indexloc提供的服务,不要输入任何密码
Skip to content

Feature request: API to allow setting thread pinning for Isolates #46943

@maks

Description

@maks

Following on from discussion in #44228 I wanted to propose an addition to the API for Isolate spawning which would allow setting the thread priority of a thread allocated to the Isolate or new Isolate group.

I'm not familiar with the implementation details of the thread pool and how threads from it are assigned to Isolates, so I'm not sure if there is currently a means to have a specific thread be assigned or tied to a specific Isolate or Isolate group.

My use case for this is I'm trying to use Dart (on Linux) for audio DSP applications (eg, synthezisers, audio fx processing, etc) and it seems the recommended way to do low latency audio output applications is to use a high priority thread to feed the OS's audio api while trying to ensure that thread never blocks. Given its currently not possible to use FFI with async callbacks into Dart Isolates and that most cross-platform audio libraries (libsoundio, jack, miniaudio) use callbacks from their own high priority "RT" thread, my thought was the next best thing could be to be able to provide a high priority thread for a single Dart Isolates group, which would then have at least 1 isolate calling a sync audio (eg ALSA) api via FFI with audio samples generated in other isolates supplied via its SendPort or FFI pointers if the sendport mechanism itself is too slow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-isolatetype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions