Android process and thread parsing, android process Parsing

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.