You are on page 1of 15

DONE BY:

K R VIKRAM (CS21B1020)
VISHNU BALAJI J (CS21B1056)
NOORAY MARIAM (CS21B1030)
Android
Architecture
Android Architecture
• The Linux Kernel :
 At the core of the Android operating system is the Linux kernel. It provides
low-level system services like memory management, process management,
networking, and device drivers.
 The Linux kernel is responsible for abstracting the underlying hardware,
enabling communication between the hardware and higher-level software
components.
Android Architecture
• Hardware Abstraction Layer (HAL) :
Above the Linux kernel is the Hardware Abstraction Layer (HAL). It acts as an
interface between the hardware-specific device drivers and the Android framework.
The HAL provides a standardized way for the higher-level Android components to
interact with the various hardware components of the device, such as camera,
sensors, and display.
Android Architecture
• Android Runtime (ART) :
ART is the runtime environment in which Android applications run. It's
responsible for executing application code and managing memory resources.
ART uses a Just-In-Time (JIT) or Ahead-of-Time (AOT) compilation process
to convert application bytecode (in the form of DEX files) into native machine
code for improved performance.
Android Architecture
• Android Framework :
The Android Framework provides a comprehensive set of APIs (Application
Programming Interfaces) and services that developers use to build
applications.
It includes various components like activities, services, content providers, and
broadcast receivers.
These components help in building the user interface, managing application
lifecycle, handling data storage, and facilitating communication between
different parts of the application.
Android Architecture
• Applications :
At the topmost layer are the applications themselves.
These include both system apps (pre-installed by the manufacturer) and third-
party apps downloaded from the Google Play Store.
Each application runs in its own sandboxed environment, ensuring isolation
and security.
Android Architecture
• System Apps and Libraries :
In addition to user-installed applications, Android includes a set of system
apps and libraries that provide core functionalities, such as the phone app,
contacts, messaging, etc.
Garbage collection
Garbage collection in the context of Android OS refers to the
automatic memory management process used to reclaim memory
occupied by objects that are no longer in use by an Android
application.

This process helps ensure efficient memory utilization and prevents


memory leaks, which can lead to performance issues and application
crashes.
Garbage Collector
• The garbage collector is a component of the runtime environment that
periodically scans the heap memory where objects are stored.
Mark-and-Sweep Garbage Collection Algorithm
• Initialization:
• Initialize a set of memory locations as the heap and maintain a set of pointers that
reference objects or data structures (called roots).
• Marking Phase:
function mark(root): Explanation :
if root is marked: • Start with the known roots (global variables,
return local variables, etc.).
mark root as marked • Traverse through the data structures, marking
each object that is reachable from the roots.
for each reference in root: • If an object is already marked, skip it to avoid
mark(reference) redundant work.

• Sweeping Phase:
function sweep(): Explanation :
for each memory location in the heap: • Iterate through the entire memory heap.
if location is marked: • For each location, if it's marked, unmark it
unmark location for the next garbage collection cycle.
else: • If it's not marked, deallocate the memory,
deallocate location making it available for future allocations.
Example

All three objects (head, temp1, and temp2) are still in


use and reachable. No garbage is collected
Example

During the marking phase, the garbage collector identifies


that “temp1” is no longer reachable and marks it for
garbage collection.

During the sweeping phase, the garbage collector reclaims


the memory occupied by “temp1”
THANK YOU

You might also like