[go: up one dir, main page]

0% found this document useful (0 votes)
75 views2 pages

Lab Solutions For Memory Management

Android devices use three types of memory: RAM, zRAM, and storage. RAM is the fastest but most limited, while storage has the most capacity but is not used for swapping. RAM is divided into pages that can be either free or used, and the proportion of free to used pages is actively managed. The Android runtime uses paging and memory mapping to manage memory allocation without paging memory out. Garbage collection frees unused memory locations, and shared memory allows processes to use the same RAM pages to optimize usage. Each app has a maximum heap size that is separate from its actual physical memory footprint.

Uploaded by

Rashi Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views2 pages

Lab Solutions For Memory Management

Android devices use three types of memory: RAM, zRAM, and storage. RAM is the fastest but most limited, while storage has the most capacity but is not used for swapping. RAM is divided into pages that can be either free or used, and the proportion of free to used pages is actively managed. The Android runtime uses paging and memory mapping to manage memory allocation without paging memory out. Garbage collection frees unused memory locations, and shared memory allows processes to use the same RAM pages to optimize usage. Each app has a maximum heap size that is separate from its actual physical memory footprint.

Uploaded by

Rashi Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS 303 – Lab 6

Answer 1: Android platforms basically focusses that free memory is equivalent to wasted
memory so they try to ensure that at any time there is minimum free memory present.
Android device consist of three different types of memory : RAM, zRAM and storage.
RAM : Fastest type of memory, but is of limited size.
zRAM : Partition of RAM used for swap space . Everything placed in zRAM is compressed.
Storage : It includes object code for all apps, libraries and platform. It has more capacity and
is not used for swap space like in other linux systems.

RAM is basically divided into pages of typical size 4KB. Pages can be either free or used. Free
is basically unused RAM. The proportion of free and used pages actively manages RAM.
Android Runtime and Dalvik virtual machine use paging and memory mapping (mmapping)
to manage memory. Any memory remains resident in RAM and cannot be paged out.
Garbage Collection: If any memory location is no longer in use then it is freed back to heap
by ART or Dalvik. Android Memory heap is a a generational one, where different allocation
buckets exists based on their expected life and size of object. Sometimes, garbage collection
process can reduce the speed of app if any intensive application is running at same time.
Share Memory: Same RAM is shared across various process to fit everything in same RAM. It
can be done in various ways using fork for app process which are forked from process called
Zygote to same RAM pages allocated to particular app to be shared across all apps. Static
data mapping into process allows the data to be shared between processes.
Each app has an individual virtual memory range called as logical heap size. This logical heap
size is not the same as the amount of physical memory used by heap. A calculation of dirty
and clean pages by system is considered as the physical memory footprint.
Android has a fixed restriction on the size of heap for each app. The size varies between
devices and apps.
Reference : https://developer.android.com/topic/performance/memory-overview

Answer 2:
a.) Continuous Memory Allocation: Here we have to perform relocation of entire program
as here there is not enough space for program to grow dynamically.
b.) Paging: We can perform dynamic memory allocation by incremental allocation of new
pages rather than relocation of entire program.

Answer 3: We generally need virtual memory support when the memory requirements of a
system or application are not known beforehand for example a general-purpose computers.
Virtual Memory support will not be required in situations where we already know the
memory requirements of system beforehand like in specialized processors or task specific
system (like electric car break design).
If virtual memory support is not present, then the code for system would be smaller and
simpler unlike the large codes.

Answer 4: Yes, it is possible for base register and limit register to contain the same values
since using Base Register we can find the start of address space for a process and limit
register contain the size of address space assigned to that process, so basically using limit
register we can find end of address space occupied by process (i.e end = base + limit of
process). Both base and limit register can have same value (with limit register value never
equal to 0) since the end address of a process space will be different from start address. For
ex. Base Register: 128, Limit Register: 128 means start address of process is 128 and end
address is 128 + 128 = 256 which is possible.

You might also like