Multitasking and RAM management are two very important terms used when discussing smartphones, especially the smartphone experience. But for a long time now, it has mostly flown under the radar of the general public.
Many of people who do discuss it, tend to use Multitasking and RAM management interchangeably. Note that even though both terms are related, they are not exactly the same.
What is Multitasking?
Multitasking, in the general sense of the word, is the ability to be able to do more than one thing at a time. With smartphones, multitasking means handling more than one app.
Once upon a time, phones could only handle one app or one task. Just one. Nothing more and nothing less. Today however, smartphones can handle several apps at once. Now you can play or listen to music, whilst browsing the web and/or checking your email.
Read: What is RAM?
How does multitasking on smartphones work?
The Operating System (OS) is in charge of multitasking. This is very true for iOS, although on Androids, the software skin usually has more of the final say.
The OS handles all instructions from the user and passes them on to the hardware. It is also in charge of all app processes in the RAM as well as RAM management. (Yeah, RAM management is a part of multitasking).
The operating system contains the address of all locations of data on the smartphone. These include both physical (RAM & Internal storage) and virtual (software). These addresses are stored in the RAM.
Whenever you boot up (turn on) your smartphone, your OS as well as all these addresses are immediately loaded into the RAM.
When you request for an app, the OS serves up the address to the CPU cores. Whilst the CPU cores go to work on tasks, the OS manages the instructions given to the CPUs. It also manages the apps that are in memory (RAM).
All Applications on your phone are in three states:
- running: apps are apps that are currently in use
- sleeping: apps are apps that are in memory but not in use
- closed: apps are apps that not in use
Paging and addressing
As earlier explained, memory usually begins virtually as software. Memory is supported by hardware. The virtual memory is mapped onto the hardware (RAM).
To better multitask and manage memory (RAM), the OS divides the available memory into pages. A page is a fixed block of memory in virtual (software) while a page frame is a fixed block of physical memory.
Pages are usually 4KB in size. There are usually a lot of pages in the RAM and the OS shares it to the app processes in memory (RAM).
Pages are mapped onto the page frame. Thus the page frame supports or is a physical representation of the virtual memory.
On most phones, there is a memory management unit (MMU). This MMU helps to convert virtual memory addresses to physical memory addresses.
RAM management
RAM management refers to the different techniques that smartphones use to manage RAM. Smartphone OS manage memory (RAM) in three main methods:
- Compression
- Swapping
- Killing
Compression
As the RAM begins to fill up, the OS would compress app processes to smaller sizes and move them to the zRAM.
Read: zRAM explained
Swapping
In order to free up RAM space, the OS may move app processes from the main memory (RAM) to the virtual memory extension.
Read: What is Virtual Memory?
Killing
The OS may completely stop (kill) app processes and remove them from memory.
The OS would usually save cache from running app processes before killing them. This would ensure that the user continues from where they left off.
We have come to the end of this post og Multitasking and RAM Management on smartphones.
Please leave a comment if you have any difficulty and remember to:
- Subscribe to our YouTube channel
- Follow on Facebook
- Join our Telegram community
- Participate on Reddit
- Find us on Quora
- Follow us on Instagram
- Check out the Clubhouse as well