10b9a52e3Sopenharmony_ci# The Part of Frame Aware Sched
20b9a52e3Sopenharmony_ci
30b9a52e3Sopenharmony_ci-   [ Introduction](#section_introduction)
40b9a52e3Sopenharmony_ci-   [ Directory Structure](#section_catalogue)
50b9a52e3Sopenharmony_ci-   [Framework](#section_framework)
60b9a52e3Sopenharmony_ci    -   [The component of Frame Information Collection ](#section_collection)
70b9a52e3Sopenharmony_ci    -   [The component of Frame Aware Policy](#section_policy)
80b9a52e3Sopenharmony_ci-   [ Usage Guidelines](#section_usage)
90b9a52e3Sopenharmony_ci-   [ Repositories Involved](#section_projects)
100b9a52e3Sopenharmony_ci
110b9a52e3Sopenharmony_ci##  Introduction<a name="section_introduction"></a>
120b9a52e3Sopenharmony_ci
130b9a52e3Sopenharmony_ciThe part of Frame Aware Sched belongs to subsystem named *Resource Schedule Subsystem*.
140b9a52e3Sopenharmony_ci
150b9a52e3Sopenharmony_ciIn 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.
160b9a52e3Sopenharmony_ci
170b9a52e3Sopenharmony_ci##  Directory Structure<a name="section_catalogue"></a>
180b9a52e3Sopenharmony_ci
190b9a52e3Sopenharmony_ci```
200b9a52e3Sopenharmony_ci//foundation/resourceschedule/frame_aware_sched
210b9a52e3Sopenharmony_ci├── common                                  # common tool class of the component
220b9a52e3Sopenharmony_ci│   └── include
230b9a52e3Sopenharmony_ci│       ├── frame_info_const.h              # frame drawing process information
240b9a52e3Sopenharmony_ci│       ├── frame_aware_constants.h         # general parameter configuration
250b9a52e3Sopenharmony_ci│       ├── frame_aware_log_domain.h        # encapsulates hilog for log printing
260b9a52e3Sopenharmony_ci│       └── single_instance.h               # class template encapslating singleton mode
270b9a52e3Sopenharmony_ci280b9a52e3Sopenharmony_ci├── interfaces
290b9a52e3Sopenharmony_ci│   └── innerkits                           # directory of internal interfaces
300b9a52e3Sopenharmony_ci310b9a52e3Sopenharmony_ci├── frameworks
320b9a52e3Sopenharmony_ci│   └── core
330b9a52e3Sopenharmony_ci│       ├── frame_aware_collector           # frame information collector in apps
340b9a52e3Sopenharmony_ci│       └── frame_aware_policy              # components of the frame_aware_sched mechanism
350b9a52e3Sopenharmony_ci360b9a52e3Sopenharmony_ci├── profiles                                # component configuration file
370b9a52e3Sopenharmony_ci└── test                                    # directory for storing self-test cases.
380b9a52e3Sopenharmony_ci```
390b9a52e3Sopenharmony_ci## Framework<a name="section_framework"></a>
400b9a52e3Sopenharmony_ci
410b9a52e3Sopenharmony_ciAccording 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.
420b9a52e3Sopenharmony_ci
430b9a52e3Sopenharmony_ci- *Frame Aware Collector*: which is the core strategy of drawing frames, including frame event processing module, slide scene strategy module, and model processing module.
440b9a52e3Sopenharmony_ci
450b9a52e3Sopenharmony_ci  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.
460b9a52e3Sopenharmony_ci
470b9a52e3Sopenharmony_ci  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.
480b9a52e3Sopenharmony_ci
490b9a52e3Sopenharmony_ci  Module-model processing module: responsible for providing the adjustment and scheduling algorithm of each sub-process.
500b9a52e3Sopenharmony_ci
510b9a52e3Sopenharmony_ci- *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.
520b9a52e3Sopenharmony_ci
530b9a52e3Sopenharmony_ci  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.
540b9a52e3Sopenharmony_ci
550b9a52e3Sopenharmony_ci  Module-Application management: responsible for the unified management of the application messages of the event processing module.
560b9a52e3Sopenharmony_ci
570b9a52e3Sopenharmony_ci  Module-RTG Managerment: the kernel interface set, sets the RTG accoding to the application state to realize thread scheduling management.
580b9a52e3Sopenharmony_ci
590b9a52e3Sopenharmony_ci  Module-Scheduling Parameter Control:responsible for reading the default scheduling prameter configuration.
600b9a52e3Sopenharmony_ci
610b9a52e3Sopenharmony_ci![](figures/zh-cn_image_fwk.png)
620b9a52e3Sopenharmony_ci
630b9a52e3Sopenharmony_ci### The component of Frame Information Collection<a name="section_collection"></a>
640b9a52e3Sopenharmony_ci
650b9a52e3Sopenharmony_ciThe *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. 
660b9a52e3Sopenharmony_ci
670b9a52e3Sopenharmony_ci- 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.
680b9a52e3Sopenharmony_ci- Adjust resource supply according to the duration of each sub-process during graphics rendering process.
690b9a52e3Sopenharmony_ci- Adjust resource supply for frame sub-process  task with high frame loss rate.
700b9a52e3Sopenharmony_ci
710b9a52e3Sopenharmony_ci### The component of Frame Aware Policy<a name="section_Policy"></a>
720b9a52e3Sopenharmony_ci
730b9a52e3Sopenharmony_ciAs 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.
740b9a52e3Sopenharmony_ci
750b9a52e3Sopenharmony_ci###  Usage Guidelines<a name="section_usage"></a>
760b9a52e3Sopenharmony_ci
770b9a52e3Sopenharmony_ciSystem developers can add or remove this part by configuring the product definition JSON file under **/productdefine/common/products** to enable or disable this part:
780b9a52e3Sopenharmony_ci
790b9a52e3Sopenharmony_ci` "resourceschedule:frame_aware_sched":{} `
800b9a52e3Sopenharmony_ci
810b9a52e3Sopenharmony_ci##  Repositories Involved<a name="section_projects"></a>
820b9a52e3Sopenharmony_ci
830b9a52e3Sopenharmony_ci- [resource_schedule_service](https://gitee.com/openharmony/resourceschedule_resource_schedule_service)
840b9a52e3Sopenharmony_ci- [ace_ace_engine]( https://gitee.com/openharmony/ace_ace_engine)
850b9a52e3Sopenharmony_ci- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
860b9a52e3Sopenharmony_ci- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard ) 
870b9a52e3Sopenharmony_ci- **frame_aware_sched**
880b9a52e3Sopenharmony_ci
890b9a52e3Sopenharmony_ci
900b9a52e3Sopenharmony_ci
91