Android process and thread parsing, android process Parsing
When an application component starts and no other components are running, the Android system creates a Linux Process for the application that contains a running thread.
By default, all components of an application run in the same process and thread (called the main thread. If an application component starts running and a process already exists in the application (this is because other components exist in the application ), the component starts and runs in the same thread in the process.
However, you can schedule different components to run in different processes in your application, and you can create additional threads for any process.
Process
By default, all components in the same application run in the same process, and most applications should not have exceptions. However, if you need to control which process a specific component should belong to, you can perform the following operations in the mainfest file:
The mainfest file of android provides an entry for each type of component elements:, and. All these component elements support android |: process attribute, this attribute is used to describe the process in which a component should run. You can set this attribute, and then each component runs in the process it belongs to, or some components can share the process while other components are not shared, this is because each application shares the same Linus user ID and is assigned the same certificate.
The element also supports the android: process attribute. If a default value is set, it can be applied to all components.
When the memory of the Android system is insufficient or other processes that serve users more directly require memory, the system may decide to kill some processes. When a process is killed, all components in the process are also destroyed.
When the system is deciding to kill a process, it will weigh the relative importance of each process to the user. For example: