# Android Background Execution, Memory Management, and WorkManager

DevFeed: [Android Background Execution, Memory Management, and WorkManager](<https://devfeed.tech/articles/services-the-life-with-without-and-workmanager-26129.md>)

Original publisher: [Read original article](<https://medium.com/google-developer-experts/services-the-life-with-without-and-worker-6933111d62a6?source=rss-8735065c2497------2>)

Author: Yonatan (Yoni) Levin

Published: 2018-05-10T17:53:59Z

Content type: tutorial

Language: en

Sources: [Stories by Yonatan V. Levin on Medium](<https://devfeed.tech/sources/stories-by-yonatan-v-levin-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Jetpack](<https://devfeed.tech/topics/jetpack.md>), [Process](<https://devfeed.tech/topics/process.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux-kernel](<https://devfeed.tech/tags/linux-kernel.md>), [management](<https://devfeed.tech/tags/management.md>), [process](<https://devfeed.tech/tags/process.md>)

## AI overview

This tutorial introduces Android background execution and explains the memory-management concepts behind it. It covers Android's Linux-based kernel, the absence of swap space, process visibility, the OOM killer, existing background solutions, and WorkManager.

## Source excerpt

With recent Android releases dealing with background, it has become more complicated than ever. Much like the Star Wars plot, it has become more and more intertwined And so, Google has released WorkManager as part of JetPack -- to help us to deal with such a background. Before learning what WorkManager is -- it's essential to understand why we need it and what was a reasons behind building it. The developers who knows what happens under the hood of the components/libraries and understand why they use it -- is by far a better developers. Better developer It's going to be a long article, so prepare a good cup of coffee & a couple of cookies. It build in 3 parts: Part #1 -- Memory Basics Part #2 -- Existing Background Solutions Part #3 -- WorkManager Firstly, before starting with all background-ish things -- we need to understand some of the basics of Android processing memory management. And this is will be our first part: Part 1: Android Memory 101 A long, long time ago, in a galaxy far far away -- Android kernel was first developed it and it was based on Linux-Kernel. The main difference between Android and all other Linux-Kernel based systems is that Android does not have a thing called "Swap space." Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory In Android, there is no such a thing as a "Swap space." When the system is running out of memory, it's using OOM Killer to save a galaxy. Out Of Memory Killer The guy's goal is to free up memory by killing the processes based on their "visibility state" and amount of memory consumed. Every process gave its oom_adj score by Activity Manager. It's a combination of application state