Thread quality of service vs. priority

Is there any proper documentation for how the thread properties qualityOfService and priority are related?

Is one the broad sword and the other one the fine one? If so, which is which?

Background: I have an iOS app that communicates with hardware. For some operations, the hardware has tight timelines, hence I would need to prioritize the communication thread over the UI thread (which is rare, but in this case necessary in order to prevent damaging the hardware).

Can anyone shed light on that or can I read up on the exact scheduler's behavior?

can I read up on the exact scheduler's behavior?

Not really. There are places where you’ll see it discussed — it’s probably covered by Singh’s Mac OS X Internals: A System Approach, although I’m too lazy to pull that off the shelf to check (-: — but the exact behaviour changes over time.

For some operations, the hardware has tight timelines

How tight?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

In the league of 100ms.

In the league of 100ms.

Oh, wow, that’s much less tight than I was expecting.

When folks are dealing with hard real-time requirements I usually point them to the time constraint policy (THREAD_TIME_CONSTRAINT_POLICY). However, that’s probably not the best option here. It has some serious pitfalls and it’s simply not necessary for a goal that loose.

Can you expand on the sort of timeline you’re looking at here? A common pattern is:

  1. Hardware signals some event.

  2. Your thread unblocks.

  3. It has to complete its work within a certain deadline.

Does your case look like that?

If so, roughly how much CPU time does the work in step 3 take?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thread quality of service vs. priority
 
 
Q