目录

About This Kit

Function Description

Kernel Enhance Kit provides kernel enhancement capabilities, including Quality of Service (QoS) scheduling, Purgeable Memory management, and the Gewu service. These capabilities help you optimize application performance, resource management, and user experience.

Basic Concepts

[h2]QoS

QoS refers mainly to the priority scheduling attribute of tasks in HarmonyOS. Developers can use QoS to classify work to be executed and indicate how closely it is related to user interaction. The system arranges the runtime and execution order of tasks based on the QoS settings.

HarmonyOS defines six QoS levels. From low to high, the degree of association with user interaction increases. The QOS_* items in the following table are API enum names.

QoS Level Scenario Load Characteristics
QOS_BACKGROUND Background tasks invisible to users, such as data synchronization and backup. The task takes minutes to hours to complete.
QOS_UTILITY Tasks that do not require an immediate visible response, such as downloading or importing data. The task takes seconds to minutes to complete.
QOS_DEFAULT Default. The task takes a few seconds to complete.
QOS_USER_INITIATED User-initiated tasks with visible progress, such as opening a document. The task completes within a few seconds.
QOS_DEADLINE_REQUEST Time-critical tasks where faster is better, such as page loading. The task completes almost instantly.
QOS_USER_INTERACTIVE User interaction tasks (UI thread, screen refresh, animations). The task is instantaneous.

[h2]Purgeable Memory

Purgeable Memory refers to memory areas that can be discarded at any time. It is used to store data that can be easily rebuilt by recalculation. When system memory is low, this data can be released directly and rebuilt when users access it again. Purgeable Memory is suitable for storing large data blocks of at least 4 KiB when the rebuild cost is low. When the system is under pressure, Purgeable Memory is preferentially reclaimed. Anonymous pages are dropped in a way similar to file pages instead of being compressed. Before the data is used again, users need to restore it by themselves.

[h2]Gewu Service

The Gewu service is a QoS-aware inference acceleration and resource management optimization service for on-device inference scenarios. On-device inference helps protect user data privacy, lowers deployment costs, reduces latency, and provides high availability without relying on network connections. However, it also faces challenges such as limited memory, limited compute resources, and power sensitivity. Through optimization methods such as dynamic on-demand resource loading and QoS-aware scheduling, the Gewu service enables efficient inference while maintaining a smooth user experience.

Benefits

[h2]QoS Optimization

Proper use of QoS can significantly improve app performance:

[h2]Purgeable Memory Optimization

Purgeable Memory is preferentially reclaimed when the system is under pressure, which can effectively relieve memory pressure.

[h2]Gewu Service Optimization

The Gewu service provides the following optimizations for on-device inference scenarios:

Constraints

[h2]QoS Constraints

[h2]Purgeable Memory Constraints

[h2]Gewu Service Constraints

References