• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Process Model (Stage Model)
2
3A process is the basic unit for a system to allocate resources, and is the basis of an operating system structure.
4
5The process model is shown below.
6
7- Generally, all UIAbility<!--Del-->, ServiceExtensionAbility, and DataShareExtensionAbility<!--DelEnd--> components of an application (with the same bundle name) run in an independent process, which is **Main process** in green in the figure.
8- All ExtensionAbility components of the same type<!--Del--> (except ServiceExtensionAbility and DataShareExtensionAbility)<!--DelEnd--> 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.
9- WebView has an independent render process, which is **Render process** in yellow in the figure.
10
11> **NOTE**
12>
13> For 2-in-1 devices, you can set a specific HAP or UIAbility to run in an independent process.
14> - 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).
15> - 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](../reference/apis-ability-kit/js-apis-app-ability-abilityStage.md) callback.
16
17**Figure 1** Process model
18
19![process-model](figures/process-model.png)
20
21> **NOTE**
22>
23> - You can create ServiceExtensionAbility and DataShareExtensionAbility only for system applications.
24> - 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.
25
26A 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<!--Del-->, DataShareExtensionAbilities, and ServiceExtensionAbilities<!--DelEnd--> in the HAP run in the custom process.<!--Del--> For details about how to request the permissions, see [Application Privilege Configuration](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).<!--DelEnd--> To configure a custom process for an HAP, use **process** in [module.json5](../quick-start/module-configuration-file.md#tags-in-the-configuration-file).
27
28**Figure 2** Multi-process
29
30![multi-process](figures/multi-process.png)
31
32
33The system provides the following inter-process communication (IPC) mechanism:
34
35
36[Common Events](../basic-services/common-event/common-event-overview.md): This mechanism is used in one-to-many communication scenarios. Multiple subscribers may receive events at the same time.
37