Saturday, December 4, 2021

iOS: QoS - Quality of service

The Quality of Service (QoS) class classifies what you want dispatchQueue to do. Indicates the importance of your app by specifying the quality of the task. When scheduling tasks, the system prioritizes tasks with higher service classes. Higher priority tasks are faster than lower priority tasks and are performed using more resources, which typically requires more energy than lower priority tasks. You can ensure your app's responsiveness and energy efficiency by specifying exactly the right QoS class for what your app does.

priority

userInteractive > userInitiated > default > utility > background


userInteractive

actions that interact with the user, such as working on the main thread, refreshing the user interface, or performing animations. focus on responsiveness and performance.

The task is almost instantaneous.


userInitiated

this class assigns it to tasks that provide immediate results for what the user is doing or prevent the user from using the app. for example, you can load the contents of the email that you want to display to the mercenary. you need immediate results, such as opening documents saved as user-initiated tasks,or performing tasks when a user clicks something in the user interface. work is required to continue user interaction. focus on responsiveness and performance.

Tasks like seconds or less are almost instantaneous.


default

The default quality of service class. Assign this class to a task or queue that your app starts or uses to perform active tasks on behalf of the user. This QoS is not used by developers to classify tasks. QoS is used as the default for unspecified operations and runs at the GCD global queue level.


utility

a quality of service class for tasks that are not actively tracked by the user. tasks that take time to complete and do not require immediate results, such as downloading or importing data. utility operations typically have progress bars that are visible to the user. it focuses on providing a balance between responsiveness, performance and energy efficiency.

The operation takes a few seconds to a few minutes.


background

tasks that work in the background and are not visible to the user, such as indexing, synchronization, and backup. focus on energy efficiency.

Tasks that take a considerable amount of time and require minutes or hours


unspecified

There are no quality of service classes. This indicates that there is no QoS information and signals that QoS should be inferred into the system. If a thread uses a legacy API, the thread can have unspecified QoS.

Reference:

No comments:

Post a Comment