Android & Linux: The Relationship Explained!

In this article let us explore the relationship between the popular Android Operating System and Linux and have a look at their similarities and differences!

For those of you in a hurry, here is the short version of the answer!

The Short Version of the Answer

The “Not-So-Obvious” Differences

Android Linux
Type of Software Operating System Kernel
Processor architecture support ARM A architecture x86 and x64 architectures
Communication Channel Optimized for Mobile networks Optimized for Ethernet and Wi-Fi
Need for creation To make Mobile Devices smart and as a competitor for iOS For the spirit of having an open source software and for research and development purposes
How the OS makes money By pushing google products and through commissions from apps, movies, music, books, etc. that are sold on the Google Play Store Most distros are community maintained and are non-profitable organizations, main source of income include tech support in the enterprise.

The Similarities

Android Linux
Kernel Linux Based Kernel Linux Kernel
License Type Open Source, Apache License Open Source, GPL V2.0 License
Price Free Free

The Obvious Differences

Android Linux
Main Device Type Smart phones Personal Computers and Servers
Main use cases Content Consumption and Communication Content creation and more serious works
Other Application areas Limited to use in Mobiles, Tablets, TVs, etc. Can be ported to virtually any device like laptops, desktops, servers, routers, phones, TVs, washing machines, refrigerators, microwave ovens, industrial applications, etc.
Ease of use Very Easy Has a little bit of a learning curve based on the Distro you choose!
Maintained by Google Lots of Companies and communities maintain the various Linux distros

The Technical Differences

Android Linux
User Space Android Run time (custom java runtime) and Core Libraries Mainly composed of GNU and X11 server
Kernel Optimization Optimized for power consumption A balanced trade-off between performance and power consumption
Shell interface Usually locked up, need to root the device to get access to the shell interface Available out of the box as shell is a particularly important part of Linux Distros!
Base for the Graphical UI Google designed Surface Flinger on top of OpenGL libraries Most distros use X11 X server based Graphical User Interface.
Framework language for end user apps Java API Framework GNOME (GTK C Library) and KDE (Qt C++ Library)
Main Architectural elements Just the Kernel, HAL and a non-GNU user space and its own desktop environment Kernel, hardware abstraction layer (HAL) (drivers), GNU User space (apps) and UI layers (Desktop environment)
Hardware Drivers Almost all of the drivers are proprietary Majority are open source
Kernel’s connection with peripherals Usually I2c and SPI, so the kernel needs to be aware that a particular peripheral exists beforehand, and drivers have to be preloaded Uses PCI, PCIe, USB etc. These protocols are self-identifying and allow the kernel to probe these devices and load necessary drivers
Bootloader Simple bootloader, that does the minimum necessary and hands the control over to the kernel Standardized bootloaders like Grub2 that can be customized
BIOS/EFI Not present on ARM devices Standard for all x86/x64 motherboards
C library Lightweight Bionic libc GNU C library

That is just the short version of the answer! Let us go ahead and look at a longer and more informative version with some explanations for the above tables of similarities and differences to get a better understanding of Linux and Android worlds!

Let us start by refreshing our memories about what operating systems are, what their duties are and how their architecture looks like.

Operating Systems: A Quick Overview To Refresh our memories

Operating systems abstract and manage the hardware resources and provide a platform on which application software can be written.

Duties of Operating Systems

The following are the main duties of a typical modern operating system

  • Manages Memory (RAM) and control its usage by Apps
  • Manages Processing power (CPU) usage by apps using a scheduler
  • Manages Disks (Hard disks & SSD) to keep each user’s files and permissions separate.
  • Provides a driver interface to write hardware driver software so that new hardware can be added to the system
  • Provides application interfaces through system calls to connect user applications with the hardware
  • Provides a graphical user interface (Desktop Environment) for the end users to interact with the software.
  • Runs services to run applications like HTTP servers, FTP servers, SSH servers, SQL servers, etc.

Parts of an operating system

To achieve the above duties, the operating system usually consists of the following modules

  • Kernel: Consists of the Scheduler, resource manager and preloaded hardware drivers
  • Hardware Access Layer (HAL): Has all the additional driver software not included with the kernel
  • GUI layer to interact with the end user
  • Software utilities, libraries, and frameworks that all services and apps share
  • End user Applications and Services

These various software modules are broadly categorized to belong to one of the following 2 categories

User space

  • Swappable memory in the RAM,
  • usually runs all the software utilities, libraries, services, and the end user apps.

Kernel Space

  • Fixed portion of the RAM than cannot be accessed,
  • runs with highest privileges.
  • Has the kernel and hardware device drivers.

GUI layer can either belong to user space (Linux) or to Kernel Space (Windows) depending upon the operating system’s architecture!

The Not so obvious differences

Android Linux
Type of Software Operating System Kernel
Processor architecture support ARM A architecture x86 and x64 architectures
Communication Channel Optimized for Mobile networks Optimized for Ethernet and Wi-Fi
Need for creation To make Mobile Devices smart and as a competitor for iOS For the spirit of having an open source software and for research and development purposes
How the OS makes money By pushing google products and through commissions from apps, movies, music, books, etc. that are sold on the Google Play Store Most distros are community maintained and are non-profitable organizations, main source of income include tech support in the enterprise.

This is where things get interesting, and I believe most of you who came here are looking for this information!

Android is an operating system, which means Android is composed of all the parts of the operating system like Kernel, Drivers, and user space software. Android is a project made to fill the need of an open source mobile operating system which was later taken over by Google to bring it to what we see today!

Android Architecture

Android’s architecture is shown in the figure below

Source: https://developer.android.com/guide/platform/images/android-stack_2x.png

As you can see the bottom most layer is the Linux kernel, but other than that, Android has so many other layers to make up an operating system suitable for mobile devices!

Explanation about each these software modules is beyond the scope of this article as our interest here is to learn the differences between Android and Linux. If you wish to learn more I suggest reading up on the official android documentation which can be found in this link.

Linux, on the other hand, is the name of the Kernel used on the popular distros like Ubuntu, Fedora, etc. The official term used to call these distros/operating systems is GNU/Linux Operating System.

Linux Architecture

The simplified view of Linux Operating System’s architecture is shown in the figure below.

As you can see Linux Distros are made up of The Linux kernel and GNU user space software. To understand what this means let us take a look at a short story on how Linux Distros came to be.

The Linux Story

Before the Beginning of the Linux Era

Before Linux, Windows and Mac came into existence, there was an operating system named Unix which was developed at Bell Labs in AT&T. (The same place where C Programming Language was developed!) But AT&T was not allowed to sell this Operating System as they were a huge company back then in the Telecom industry and the U.S government wanted to make sure a monopoly does not form in the computing industry. So instead of selling Unix, AT&T decided to license its source code to Universities and other companies for a fee.

The Spirit Behind Linux

At that point in time, a group of young software professionals, who licensed this Unix operating system wanted to make some changes/improvements to Unix as they had the source code and they wanted everyone to benefit from it by distributing those improved versions of Unix. But the license prevented them from doing so, which they felt was unfair as all the work they put in is not going to have a good impact on the rest of mankind.

Also, there were other software at that time, which did not even let them look at the source code, as it was distributed as plain installable binaries (as most paid software is till today)

They then decided to form an organization called the “Free Software Foundation” with some simple rules to achieve their goal which is to make sure that the user of the software has control over what the software does on his/her computer and not the software maker.

To accomplish this goal, they made 4 simple rules/guiding principles/freedoms as shown in the image above!

  • the user decides what this software can be used for
  • the source code will always be distributed with the software
  • the user is free to give out copies of that software
  • the user is free to make changes and give out those changes

By using these guiding principles, they wanted to make their own software to replace Unix and the GNU project was formed to make their own copy of the Unix operating system by writing all the code themselves.

GNU stands for GNU is not Unix, a recursive acronym.

All the software was ready, but the kernel was getting delayed. The kernel is the core of the operating system which makes an interface for the software and the hardware.

Luckily for them, a Finnish student named “Linus Torvalds” was making a kernel as a hobby project. He contributed his code to the GNU project and thus GNU/Linux Operating System was born!

Need for Distributions

The word Distro is short for distribution. Delivering the Operating System to the end-users was one of the first problems faced by the GNU/Linux operating system. The team had all the source code and so if anyone wanted a copy, then they have to download the source code and compile it all themselves, then link them together to make a working operating system, which seemed like a Herculean task for the beginners to the operating systems arena. The compilation step was left to the end-user because the final operating system image must match the processor architecture. As most users were computer experts there was no big issue. But as Linux gained popularity the ratio of newbies vs experts gradually shifted to the favour of newbies and a need for prebuilt operating system image came up!

As a large majority of people who wanted to use this Free software (Free as in Freedom and not Free lunch!) were newbies, the software was prebuilt to compile on the all popular processor architectures and was distributed as images so that the end-user can skip the hard steps of the compilation of source code and building the OS themselves.

They also made sure that the source code was available for download online so that the user’s freedoms are preserved. Since the source code is open for everyone to see, large communities started evolving online to make the code better and to bring together Operating Systems suited towards more specific needs/goals.

These “specific needs/goals” include, but not limited to the following.

  • producing documents
  • writing programs and creating software
  • editing pictures, videos, audio, and multimedia-production related works
  • securing the operating system so that no one can hack into it or
  • just browse the internet and consume media.

Say a community of people just wanted to browse the internet with their computers, then there is no point giving them the software to write programs in. Thus, since every community’s needs and goals were different these communities started distributing built images of this operating system with all the essential tools installed.

Thus, the age of Distros began! If you look at distrowatch.com there are over 1000 Linux distributions available for download each one trying to fill a specific market need!

I guess after reading this short story, you will have a better understanding of the first point in the table above.

Other than the fact that they are 2 different classes of software, the only main difference is Android is optimized for mobile devices and ARM architecture, while Linux is a versatile piece of software!

If you wish to know the difference between Linux distros and Android OS, they can be summarised by the fact that Android is Non-GNU/Linux whereas the distros are GNU/Linux! This means that android uses the Linux Kernel with its own software on the user space while the Linux distros use the Linux kernel with GNU utilities and libraries!

To learn more about how these open source operating systems make money I suggest reading this other article I wrote given in the link below.

How Do Linux Distros Make Money? Strategies Explained!

The Obvious Similarities & Differences

For the sake of completeness and just for fun, let us have a look at the obvious similarities and differences between Android and Linux!

The Similarities

Android Linux
Kernel Linux Based Kernel Linux Kernel
License Type Open Source, Apache License Open Source, GPL V2.0 License
Price Free Free

The above table shows the similarities between Android and Linux. The key point to address here is Android uses a customized Linux Kernel and the Linux distros use the mainstream version of the Linux Kernel.

The Obvious differences

Android Linux
Main Device Type Smart phones Personal Computers and Servers
Main use cases Content Consumption and Communication Content creation and more serious works
Other Application areas Limited to use in Mobiles, Tablets, TVs, etc. Can be ported to virtually any device like laptops, desktops, servers, routers, phones, TVs, washing machines, refrigerators, microwave ovens, industrial applications, etc.
Ease of use Very Easy Has a little bit of a learning curve based on the Distro you choose!
Maintained by Google Lots of Companies and communities maintain the various Linux distros

The above table shows the obvious differences between Android and Linux, The key point to address here is the fact that while the application areas of Android is limited, Linux kernel can be used on any device with enough capabilities to run the kernel. I have made a video and written an article about a class of devices called Embedded Linux Devices, which can be found in the link below.

Video: Embedded Linux Explained..!!

Technical Differences

For those of you who are tech savvy, here is a brief list of technical differences between Android and Linux!

Android Linux
User Space Android Run time (custom java runtime) and Core Libraries Mainly composed of GNU and X11 server
Kernel Optimization Optimized for power consumption A balanced trade-off between performance and power consumption
Shell interface Usually locked up, need to root the device to get access to the shell interface Available out of the box as shell is a particularly important part of Linux Distros!
Base for the Graphical UI Google designed Surface Flinger on top of OpenGL libraries Most distros use X11 X server based Graphical User Interface.
Framework language for end user apps Java API Framework GNOME (GTK C Library) and KDE (Qt C++ Library)
Main Architectural elements Just the Kernel, HAL and a non-GNU user space and its own desktop environment Kernel, hardware abstraction layer (HAL) (drivers), GNU User space (apps) and UI layers (Desktop environment)
Hardware Drivers Almost all of the drivers are proprietary Majority are open source
Kernel’s connection with peripherals Usually I2c and SPI, so the kernel needs to be aware that a particular peripheral exists beforehand, and drivers have to be preloaded Uses PCI, PCIe, USB etc. These protocols are self-identifying and allow the kernel to probe these devices and load necessary drivers
Bootloader Simple bootloader, that does the minimum necessary and hands the control over to the kernel Standardized bootloaders like Grub2 that can be customized
BIOS/EFI Not present on ARM devices Standard for all x86/x64 motherboards
C library Lightweight Bionic libc GNU C library

The key changes made to the kernel space on Android is to make sure that the devices consume as little power as possible to provide us with an all-day battery life on our smart phones! Also, the fact that user space is completely different between android and Linux distros makes it hard to run android apps on a Linux distro! We are going to need to compile and port a lot of software if we wish to accomplish that!

Also, another point worth noting here is that the shell interface is usually locked on Android as this operating system is aimed at general-public and not the tech enthusiasts. This way the devices can be made more secure!

And with that, I will conclude this article!

I hope you guys enjoyed this article and learned something useful.

If you liked the post, feel free to share this post with your friends and colleagues!

Related Articles

A Complete Guide For Choosing A Distro For Your Computer’s Specs..!!

Best Linux Distro For Workstation: Analysis and Comparison!!

How Do Linux Distros Make Money? Strategies Explained!

Can You Make A Linux Distro And Sell It? An Analysis!

A Step By Step Plan To Learn Linux..!

Lightweight vs Heavyweight Distros: A Comparison!

Distro-Hopping, What, Why & How Explained!

Linux Distros vs Flavors vs Derivatives: Differences Explained!

Photo of author
Editor
Balaji Gunasekaran
Balaji Gunasekaran is a Senior Software Engineer with a Master of Science degree in Mechatronics and a bachelor’s degree in Electrical and Electronics Engineering. He loves to write about tech and has written more than 300 articles. He has also published the book “Cracking the Embedded Software Engineering Interview”. You can follow him on LinkedIn