[Development] Thread / Process Quality of Service APIs in Qt

Mårten Nordheim marten.nordheim at qt.io
Thu Oct 3 11:55:32 CEST 2024


I have updated the patch here to add some minimal API to QThread:
https://codereview.qt-project.org/c/qt/qtbase/+/593378

Should also do QThreadPool when I think about it.

Please give feedback, thanks,
Mårten

From: Tor Arne Vestbø <Tor.arne.Vestbo at qt.io>
Sent: fredag 27. september 2024 12:54
To: Mårten Nordheim <marten.nordheim at qt.io>
Cc: Volker Hilsheimer <volker.hilsheimer at qt.io>; development at qt-project.org
Subject: Re: [Development] Thread / Process Quality of Service APIs in Qt




On Sep 27, 2024, at 12:49, Mårten Nordheim via Development <development at qt-project.org<mailto:development at qt-project.org>> wrote:




-----Original Message-----
From: Volker Hilsheimer <volker.hilsheimer at qt.io<mailto:volker.hilsheimer at qt.io>>
Sent: torsdag 26. september 2024 17:18
To: Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>>; development at qt-
project.org<http://project.org/>
Subject: Re: [Development] Thread / Process Quality of Service APIs in Qt




On 24 Sep 2024, at 23:23, Mårten Nordheim via Development
<development at qt-project.org<mailto:development at qt-project.org>> wrote:


Hello,

For a while now there has been "Quality of Service" APIs available for
threads and processes in at least Apple and Windows.

Typically you can request either "Eco", and Default (i.e. the OS does its
normal thing)


[...]

Thanks,
Mårten


Based on my interpretation, I think we can start with a low-level but dirt-
simple API that allows applications set a preferred CPU core type (e.g. Eco vs
Default) on which a thread might run, together with the existing thread
priority.

Coupling thread priority and preferred CPU type into a “task type” or “load
category” as a convenient, higher-level abstraction can be a follow-up,
utilising the former lower-level API. Good naming of those seems hard; I’d
stay away from domain specific task type names like “AudioProcessing”.

Not sure if it’s useful to have a QCoreApplication API in addition to a QThread
API; I’d expect that calling the static QThread setters from main() would be the
same as calling the QCoreApplication setter.

Volker

On Windows there is an API for setting it on the process-level. And I thought
there was one for macOS as well, but it seems to be more focused on labelling
the workloads that the application is doing, rather than labelling the whole
application. So, thread-specific is a safe choice.

Sounds good. A minimal API for the QoS seems like a good start in any case, even if we later decide on a higher level “workload” categorization API.

Tor Arne

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20241003/61fde18c/attachment-0001.htm>


More information about the Development mailing list