Process Management
Process Management
Foreground Processes: These are actively interacting with the user, such as an app being used. They
have the highest priority and require the most system resources.
Visible Processes: These are processes visible to the user but not actively in use. For example, an app
on-screen but not actively interacted with. They need significant resources to maintain a smooth
experience.
Service Processes: These run in the background for tasks like syncing data or notifications. They have a
medium priority and do not directly interact with the user.
Background Processes: These are idle processes performing minimal tasks. They can be terminated if
the system needs resources.
Empty Processes: These have no active functionality and are kept in memory only to speed up app
relaunches. They are the first to be terminated to free resources.
AIDL (Android Interface Definition Language): Best for two-way communication with complex data. It is
secure but complex to implement, involving interface definitions and handling threads.
Messenger: Simpler than AIDL and supports two-way communication. It is ideal for basic tasks but limited
to handling one request at a time.
Intent: The simplest IPC method. It is secure but supports only one-way communication, making it
unsuitable for ongoing interactions.
Services:
Started Services: Run until explicitly stopped (e.g., downloading files).
Bound Services: Provide interfaces for communication with other components (e.g., syncing data).
Broadcast Receivers: Respond to system-wide events like network changes but are not suitable for heavy
tasks.
JobScheduler: Manages tasks under specific conditions (e.g., Wi-Fi connectivity) and consolidates tasks
to save battery life.
WorkManager: Schedules reliable tasks that persist across app or device restarts. It supports one-time or
periodic tasks.
AlarmManager: Schedules tasks at specific times but is less efficient for frequent tasks.
Foreground Services: Handle ongoing tasks critical to user experience, requiring a persistent notification
to prevent termination.
Cached processes enable faster app relaunches and switching, improving multitasking.
Tools like onTrimMemory(), Doze Mode, and App Standby reduce unnecessary resource usage,
enhancing performance and battery life.
Process Isolation: Unique user IDs (UIDs) prevent unauthorized data sharing.
Sandboxing: Restricts app interactions to maintain security.
Permission-Based Access: Apps access data only with user consent, preventing malware and protecting
system integrity.
Context Switching: Saves and restores app states during transitions, ensuring seamless multitasking.
Memory Allocation: Assigns or reclaims RAM based on app priority.
Demand Paging: Loads only necessary parts of an app to optimize memory.
App Swap-In: Restores app states when switching back to previously closed or backgrounded apps.