In traditional Linux operating systems, the lifecycle of application processes is mainly directly controlled by the application itself. However, system resources (including CPU, I/O, storage, etc.) are limited. When we run a large number of I/O intensive or CPU intensive applications, we often experience system stuttering or even "false crashes", which greatly affects the user's operating experience. For this reason, we have designed a "graded freezing" mechanism in the openKylin operating system to control the application lifecycle.
What is the 'graded freezing' mechanism?
The "graded freezing" mechanism refers to the "graded" processing of applications in different states in the operating system, which "freezes" users' non operating applications in a special way, thereby releasing system resources (such as CPU, disk I/O, memory, etc.), prioritizing the allocation of resources for users to operate applications and improving user experience.
Classification of the "graded freezing" mechanism
In the openKylin operating system, we divide applications into the following levels:
1. Focus application
Indicates the application currently in operation. Generally, resource restrictions are not applied to it to fully ensure its smoothness.
2. Front end applications
There is only a state in PC mode, indicating the currently running application that has not been minimized but has not received focus.
3. Background applications
In PC mode, it refers to an application with a window minimized state and a duration of ≤ 30min or a front-end application duration of ≥ 30min;
In tablet mode, it refers to an application process that is not currently open and has a duration of ≤ 30min.
4. Caching applications
Refers to applications that are in an invisible state and have a duration of>30 minutes.
5. Sleep application
Applications that have been frozen and placed in swap partitions.
Among them, the state timing transition of applications at all levels is shown in the following figure
Based on the above application classification, openKylin has implemented the following features:
1. Single instance startup
In tablet mode, applications are started in a single instance mode and the startup status of each application is recorded, which is implemented uniformly by the system interface, without the need for individual application adaptation.
2. Real time regulation of backend resources
For backend applications, when the remaining resources of the system reach our predetermined threshold, corresponding resource regulation is carried out according to system policies and user settings to reduce system power consumption and improve the smoothness of frontend applications.
3. Application level sleep
Under specific conditions, the application will be completely frozen, saving CPU and memory resources.
4. Multimedia protocol extension support
Implement background pause/playback functions for multimedia applications such as video and audio, allowing users to more flexibly control entertainment.
The openKylin "graded freezing" mechanism can not only further improve system performance, provide users with a smoother usage environment, but also bring a new optimization and innovation idea for domestic operating systems. And next, openKylin will continue to invest in the research and optimization of the "graded freezing" mechanism, helping the rapid development of domestic operating systems.
The openKylin community aims to build a partnership ecosystem with enterprises through open source, voluntary, equal, and collaborative approaches, with "co creation" as its core. Together, it aims to create a top-level community for desktop operating systems and promote the prosperity and development of Linux open source technology and its software and hardware ecology.
The first batch of council members in the community include 13 industry colleagues and institutions, including Qilin Software, Puhua Basic Software, Zhongke Fangde, Qilin Xin'an, Ningsi Software, Yiming Software, ZTE New Fulcrum, Yuanxin Technology, China Electronics Technology 32 Institute, Technology and Ethics System, Beijing Linzhuo, and Advanced Operating System Innovation Center.