README.md
1# The Part of Frame Aware Sched
2
3- [ Introduction](#section_introduction)
4- [ Directory Structure](#section_catalogue)
5- [Framework](#section_framework)
6 - [The component of Frame Information Collection ](#section_collection)
7 - [The component of Frame Aware Policy](#section_policy)
8- [ Usage Guidelines](#section_usage)
9- [ Repositories Involved](#section_projects)
10
11## Introduction<a name="section_introduction"></a>
12
13The part of Frame Aware Sched belongs to subsystem named *Resource Schedule Subsystem*.
14
15In order to ensure the cpu scheduling supply, it updates the process scheduling groups and adjust the kernel schedule parameters to influence the kernel scheduling behavior according to the information of the application frame drawing and the application life cycle status.
16
17## Directory Structure<a name="section_catalogue"></a>
18
19```
20//foundation/resourceschedule/frame_aware_sched
21├── common # common tool class of the component
22│ └── include
23│ ├── frame_info_const.h # frame drawing process information
24│ ├── frame_aware_constants.h # general parameter configuration
25│ ├── frame_aware_log_domain.h # encapsulates hilog for log printing
26│ └── single_instance.h # class template encapslating singleton mode
27│
28├── interfaces
29│ └── innerkits # directory of internal interfaces
30│
31├── frameworks
32│ └── core
33│ ├── frame_aware_collector # frame information collector in apps
34│ └── frame_aware_policy # components of the frame_aware_sched mechanism
35│
36├── profiles # component configuration file
37└── test # directory for storing self-test cases.
38```
39## Framework<a name="section_framework"></a>
40
41According to the thread it belongs to during execution, the *Farme Aware Sched* is devided into two parts, which are *Frame Aware Collector* and *Frame Aware Policy*. The framework is shown in the following picture.
42
43- *Frame Aware Collector*: which is the core strategy of drawing frames, including frame event processing module, slide scene strategy module, and model processing module.
44
45 Module-frame event processing : responsible for coordinating and dispatching the message information of the frame drawing sub-process of the JS-UI subsystem and the Graphic subsystem.
46
47 Module-slide scene strategy: responsible for the sliding scene recognize and provide the scenario-based fine scheduling by the interface of the model processing module.
48
49 Module-model processing module: responsible for providing the adjustment and scheduling algorithm of each sub-process.
50
51- *Frame Aware Policy*: which is consists of four part: event processing module, application management module, and RTG (Related-Thread-Group) management module and scheduling parameter control module.
52
53 Module-Application state event processing: which is responsible for registering and receiving messages from the global resource management and control subsystem, such as application state switch, window focus state change, etc, and distributing messages to the application management and control module and RTG grouping module.
54
55 Module-Application management: responsible for the unified management of the application messages of the event processing module.
56
57 Module-RTG Managerment: the kernel interface set, sets the RTG accoding to the application state to realize thread scheduling management.
58
59 Module-Scheduling Parameter Control:responsible for reading the default scheduling prameter configuration.
60
61![](figures/zh-cn_image_fwk.png)
62
63### The component of Frame Information Collection<a name="section_collection"></a>
64
65The *frame information collection* is mainly responsible for adjusting the parameters of kernel scheduling and scaling the thread load. When the user slides on the application, it recognizes the key threads (such as draw frame thread and render thread) , perceives the sub-process of the application frame drawing, and adjust the kernel scheduling parameters according to the task timeout status to perform real-time resources.
66
67- According to the screen refresh rate, it analyze the current frame rate information. The resource supply of key threads is increased according to the time to end of the drawing frame.
68- Adjust resource supply according to the duration of each sub-process during graphics rendering process.
69- Adjust resource supply for frame sub-process task with high frame loss rate.
70
71### The component of Frame Aware Policy<a name="section_Policy"></a>
72
73As the basis for the realization of application frame perception, the *frame aware policy* is mainly reposible for controlling thread groups and thread priorities, realizing the unified management of application threads and ensuring the performance of the entire system.
74
75### Usage Guidelines<a name="section_usage"></a>
76
77System developers can add or remove this part by configuring the product definition JSON file under **/productdefine/common/products** to enable or disable this part:
78
79` "resourceschedule:frame_aware_sched":{} `
80
81## Repositories Involved<a name="section_projects"></a>
82
83- [resource_schedule_service](https://gitee.com/openharmony/resourceschedule_resource_schedule_service)
84- [ace_ace_engine]( https://gitee.com/openharmony/ace_ace_engine)
85- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
86- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard )
87- **frame_aware_sched**
88
89
90
91