[New-bugs-announce] [issue47064] thread QOS attribute on macOS

Ronald Oussoren report at bugs.python.org
Sat Mar 19 05:57:26 EDT 2022

New submission from Ronald Oussoren <ronaldoussoren at mac.com>:

Arm based Mac systems have several types of cores: performance cores and efficiency cores.  The system has no way to directly specify which core a particular proces or thread uses, but programs can use an API for setting the QOS class of a thread that will influence which type of core a proces is scheduled on.

The primary use case for this would be to select a lower QOS class for background tasks to ensure that those minimally impact interactive code.

It would be nice to expose this functionality in Python.

One way to do this is to expose two or three new APIs:

0. Expose an enum.IntEnum on macOS for the various QOS classes

1. An API for setting the QOS class of a particular thread (which could also be used to change that class for the main thread), for example a read/write property ``threading.Thread.qos_class``

2. A new keyword argument ``qos_class`` to ``threading.Thread.__init__()``

3. Optional: an API for setting changing the default value for that new keyword argument

The new API would only exist on macOS.

One consideration: This is a platform specific option, in my limited research I haven't found an easy way to accomplish similar results on Linux or Windows.

Background information: https://developer.apple.com/documentation/apple-silicon/tuning-your-code-s-performance-for-apple-silicon

components: Interpreter Core, macOS
messages: 415538
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: thread QOS attribute on macOS
type: enhancement
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list