← Back to context

Comment by masklinn

19 days ago

The baseline is static: low QoS tasks are dispatched to the E cores, while high QoS tasks are dispatched to P cores. IIRC high QoS cores can migrate to the E cores if all P cores are loaded, but my understanding is that the lowest QoS tasks (background) never get promoted to P cores.

How is the QoS communicated to the scheduler? Is there a mark on the binary or does the code do it at thread startup?

  • The Apple software stack makes heavy use of thread pools via libdispatch. Individual work items are tagged with QoS, which influences which thread picks up the work item from the queue.

    • There's also priority inheritance (two different systems for it) so that requests originating from users/apps are more important.

      Swift concurrency is more about structured concurrency than thread pools. A lot of other systems seem to use futures, which aren't good at priority inheritance.