Skip to content

std.Io.Threaded: when concurrent tasks caused pool to be oversize, reduce pool down to cpu count upon idling #25748

@andrewrk

Description

@andrewrk

Extracted from #25592.

Calling io.concurrent causes concurrent_count to increment, which can potentially make the thread pool larger than cpu_count. When a worker becomes idle, if it takes the concurrency count down enough, then the worker should exit so that the pool can downsize closer to the ideal setting.

            if (is_concurrent) {
                t.concurrent_count -= 1;
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.optimizationstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions