Project

General

Profile

Actions

Feature #17566

open

Tune thread QoS / efficiency on macOS

Added by mperham (Mike Perham) almost 4 years ago. Updated 12 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:102185]

Description

Hi, new Apple M1 processors have "performance" and "efficiency" cores. Apple provides a QoS API so threads can tune which cores they should execute on. Some threads should be executed as high-priority, some should be treated as low-priority.

This page shows the pthread APIs that Apple provides:

https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/PrioritizeWorkAtTheTaskLevel.html

pthread_set_qos_class_self_np(QOS_CLASS_BACKGROUND, 0)

I noticed Ruby already provides Thread#priority= which says This is just hint for Ruby thread scheduler. It may be ignored on some platform. Does this API work still or was it only active for Ruby 1.8's green threads? Should this API use the QoS APIs on macOS?

Actions

Also available in: Atom PDF

Like0
Like0Like0