# A guide to Linux for embedded applications
> Today, more than 96.4% of the top 1 million server applications run on Linux. Across public clouds, 90% of the workloads use Linux as their OS, with Ubuntu being the most popular distro. Moving past its initial debut as a general-purpose **operating system** for i386-based hardware, Linux has seen widespread adoption for Embedded Systems ever since.
## What is Embedded Linux
Embedded Linux can often be confusing as to what it really is. The article will take three major approaches
- The system
- The kernel
- The distribution
### The system
With System on Chips (SoCs) harwade with low-power and small footprint becoming more and more popular as the processor choice for embedded systems together with steady progress in the semiconductor technology, A scaled-down embedded friendly version of Linux has become more available to the market. This is possible because flash memories (ROM) are becoming cheaper and cheaper with more storage, which allows the neccessary storage for Linux filesystems.
Embedded linux varies in size and can be brought down to three main categories.
- Small-sized systems with a CPU with atleast 2 MB of ROM and 4MB of RAM.
- Medium-sized systems with around 32 MB of ROM and 64 MB of RAM.
- Large-sized systems with fullscaled CPUs and larger memory footprints.
The specs of the small sized systems is what is needed to incorporate on-chip MMU hardware. However Linux can be utilized on non MMU systems with the addition of microClinux, which uses a scaled down version of the Linux kernel together with a stripped-down C-library.
some systems using embedded linux today are
- BioEntry R2 (Biometric access control)
- ZIPABOX2 (Smart home server)
- Allor Smart Hub (Home automation).
Conclusion: Embedded linux denotes an embedded system running any version of the Linux Kernel.
### The Linux kernel
Linux kernel is part of the family of Unix-like OS kernels. On startup Kernel loads into RAM and stays there throughout the session. As it is the first program to load it is the fundamental core of the OS, which means it has complete control over everything occuring in the system.
Similar to how user applications run in user space, kernel executes processes in the kernel space.
### The distribution
A linux distribution is a development framework hosted on top of the operating system.
after boot, the kernel **Mounts** the root file system. All distributions have their own niches but even the tiniest embedded distro comes with necessary bins, tools and utils.
Not all distros are suitable for embedded enviroment. The ones that are, differs alot from desktop distros, for example most embedded distros do not have a GUI stack.
## Embedded applications and microcontrollers
Not so much interesting here
## Embedded Linux and Real-time
see **Throughput** vs **Latency**
three different types of Real-time
- **Hard** system failure upon missed deadline
- **Firm** System can whitstand a few deadlines
- **Soft** Degraded system upon missed deadline, but operation continous
For embedded linux, developers usally relies on **PREEMPT-RT** patch. the Preempt patch uses a priority scheduler and other supporting real-time mechanisms. Preempt Linux kernels provide near real-time performance but with an operational cost.
## Why use Embedded Linux