Current location - Health Preservation Learning Network - Healthy weight loss - Technical interpretation: How is the atomic memory mechanism of Xiaomi MIUI realized?
Technical interpretation: How is the atomic memory mechanism of Xiaomi MIUI realized?
10 In August, at the annual speech of "My Dream, My Theme" 202 1 and the release of Xiaomi's autumn new products, Xiaomi MIX 4 was officially released, which not only grabbed the Qualcomm Snapdragon 888+ chip, but also adopted a brand-new full-screen cup, and achieved 100% through the pioneering micro-drilling arrangement technology. In terms of shell technology, Xiaomi once again optimized the ceramic body, which has a better touch and a 30% weight reduction.

Xiaomi MIX 4 adopts a number of "black technologies" at the hardware level, while MIUI, as a system software, is refreshing in the combination of software and hardware, although there are no new functions released. Atomic memory mechanism is a functional optimization that Jin Fan, director of Xiaomi products and general manager of MIUI experience, emphasized when introducing MIUI 12.5 enhanced version.

Through the atomic memory mechanism, MIUI 12.5 enhanced version can achieve ultra-fine memory management, split application memory, and give priority to ending unimportant tasks, instead of forced retirement of violent programs, so that the system memory can be used more finely. Jin Fan said that taking Xiaomi 10 speed commemorative edition as an example, the background resident capacity increased by 64%.

You can't help asking, is this really "black technology"? Or how is this "black technology" realized?

Here we have to find out how Chu Yuan Android works with the system hardware. In the construction of the underlying system, native Android chooses a layered structure, namely, application layer, application framework layer, system running layer, hardware abstraction layer and Linux kernel layer.

In these five layers, the application layer is responsible for interaction; The application framework layer is used for application development; The system operation layer is responsible for downloading applications locally and supporting multi-application parallelism; The hardware abstraction layer is responsible for abstracting and controlling hardware; Linux kernel layer has drivers specifically for Android.

To understand this hierarchy, the change of Xiaomi MIUI should be clear-Xiaomi has been optimized in the system runtime layer and hardware abstraction layer.

The system runtime layer of native Android is subdivided. Part of it is C/C++ library, which mainly provides basic performance support, such as OpenGL ES, SQLite, a lightweight relational database engine, SGL, and the underlying 2D graphics rendering engine. This part needs special mention of SQLite. According to Jin Fan's description, atomic memory mechanism can prioritize and delete application processes, so it is necessary to adjust the working mode of SQLite to make the recording mode of application processes conform to the working principle of atomic memory mechanism. Jin Fan's single-process deletion and program slimming also need to make a fuss about the database.

The other part of the system runtime layer is the runtime library, which is a special computer library used by the compiler to realize the built-in functions of the programming language and provide runtime support for the programs of the language. The important role of this part is to provide the most basic implementation requirements. The atomic memory mechanism of Xiaomi MIUI is a special process execution. The system runtime layer initially supported multi-application parallelism, but the number supported was limited. Therefore, Xiaomi MIUI needs customized execution support, and this part should be adjusted and optimized.

The hardware abstraction layer enables the system to write hardware drivers in kernel space, add interfaces to support hardware access, and realize hardware access through Java interfaces. Through Jin Fan's description, it is not difficult to find that the hardware drivers realized by the hardware abstraction layer of native Android should be set in blocks. Each application is a block, and all the processes of the application are in this block. When the system memory can't run the newly opened application, in chronological order, it is necessary to forcibly retreat the earlier opened application and reload it next time.

Conceptually, we can see the atomic memory mechanism of Xiaomi MIUI. They changed the driving mode of the program, so that each application no longer exists in memory completely, but cut it in multiple dimensions, including the decomposition of threads and the compression function of application loading package envelopes. In addition, threads can be added and deleted independently, and the application itself can be further compressed when necessary, so that more applications can be accommodated in the memory.

Compared with competing Android flagship model, when * * * opens 10 applications, the model equipped with Xiaomi MIUI 12.5 enhanced version can keep all applications in the background, while competing Android flagship model has three applications, and other programs are "killed" in the background.

However, from the feedback of early users of Xiaomi, the performance of Xiaomi MIUI 12.5 enhanced version is still not stable. Some netizens gave feedback in Xiaomi community. Even if Xiaomi MIUI 12.5 enhanced version is used, the background killing still exists.

Whether this situation is a case or a common phenomenon at present needs to be known after Xiaomi MIUI 12.5 enhanced version is publicly listed.