harmony 鸿蒙Process Model (Stage Model)
Process Model (Stage Model)
A process is the basic unit for a system to allocate resources, and is the basis of an operating system structure. The process model is shown below.
- Generally, all UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components of an application (with the same bundle name) run in an independent process, which is Main process in green in the figure.
- All ExtensionAbility components of the same type (except ServiceExtensionAbility and DataShareExtensionAbility) of an application (with the same bundle name) run in an independent process, such as FormExtensionAbility process, InputMethodExtensionAbility process, and other ExtensionAbility process in blue in the figure.
- WebView has an independent render process, which is Render process in yellow in the figure.
NOTE
For 2-in-1 devices and tablets, you can set a specific HAP or UIAbility to run in an independent process. - To enable a HAP to run in an independent process, set the isolationMode field in the module.json5 file to isolationOnly (running only in an independent process) or isolationFirst (running in an independent process preferentially). - To enable a UIAbility to run in an independent process, set the isolationProcess field in the module.json5 file to true and return a unique process ID in the onNewProcessRequest callback.
Figure 1 Process model
NOTE
- You can create ServiceExtensionAbility and DataShareExtensionAbility only for system applications.
- To view information about all running processes, run the hdc shell command to enter the shell CLI of the device, and run the ps -ef command.
A system application can apply for multi-process permissions (as shown in the following figure) and configure a custom process for an HAP. In this way, the UIAbilities, DataShareExtensionAbilities, and ServiceExtensionAbilities in the HAP run in the custom process. For details about how to request the permissions, see Application Privilege Configuration. To configure a custom process for an HAP, use process in module.json5.
Figure 2 Multi-process
The system provides the following inter-process communication (IPC) mechanism:
Common Events: This mechanism is used in one-to-many communication scenarios. Multiple subscribers may receive events at the same time.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Obtaining Reasons for Abnormal Application Exits
harmony 鸿蒙UIAbility Backup and Restore
harmony 鸿蒙Using Explicit Want to Start an Application Component
harmony 鸿蒙Introduction to Ability Kit
harmony 鸿蒙AbilityStage Component Container
harmony 鸿蒙Accessing a DataAbility
harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model
harmony 鸿蒙Common action and entities Values (Not Recommended)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦