[MUSIC] Welcome to part one in our lesson on the Android Linux Kernel, which describes its support for primary and secondary storage mechanisms. After completing this part of lesson, you'll recognize these two types of storage mechanisms supported by Android Linux. Let's start by giving an overview. Android's software instructions and data reside in two different types of storage. One type is called primary storage, which is fast random access memory or RAM. The contents of RAM are volatile, which means that it's wiped out whenever a device is rebooted or loses power. Another type of storage supported by Android Linux is called secondary storage, which is slower flash memory. Flash memory is persistent storage that could be erased and reprogrammed electronically. Primary and secondary storage form part of a so-called memory hierarchy. In general, being higher in this hierarchy has several implications. For example, it typically means that memory bandwidth is faster. In other words, the rate in which the data can be read from or stored into is higher. Likewise, CPU access latency is lower, which is defined as the time interval between when a CPU initiates a call for fetching or storing data, and when the call actually completes. Yet another implication of being higher in the hierarchy is that the cost is greater. Typically, the faster the memory access the costlier it is. Processor cores operate on instructions and their associated data that reside in random access memory. For example, the Android Linux Kernel executes in so called kernel space RAM. Kernel space is a protected region of RAM that's used to run so-called privileged operations that not all applications can access. Thus, Kernel space can be accessed by user processes only via system calls. All Android applications execute in user space RAM. User space is a more restrictive protection domain than kernel space. What this means, of course, is that apps that are running in user space, normally can't access the RAM of other apps unless it's explicitly allowed. We'll talk later about anonymous shared memory in part 3 of this lesson to give you some examples of cases where apps can access memory that are shared with other apps. The cost and performance of both primary and secondary storage has improved substantially in recent years. However, primary storage, or RAM, on an Android mobile device is still typically constrained. For example, if you take a look at a mobile device today, the high end mobile devices, around this time frame, which is towards the end of 2016, typically give you 1 to 2 gigabytes of memory. In contrast, a desktop or laptop, typically has 8 to 32 gigabytes. There's also issues of price point. Lower cost mobile devices typically have much less RAM than higher cost devices. So you're paying for the speed improvement. Android Linux's virtual memory manager features address various constraints of the limited memory that's available. For example, virtual memory helps conserve RAM by not moving app instructions and data from secondary to primary storage until they're actually accessed. Keep in mind again that secondary storage is slower, in fact much slower, than primary storage. So the instructions and data need to be moved from the secondary storage to the primary storage before they can be executed. Another benefit of Android's virtual memory manager is it allows acceleration of I/O operations by a so-called memory mapping of files & hardware devices. And finally, virtual memory management protects an app's private data in RAM from accidental or attempted malicious access by other apps. Secondary storage in Android Linux is typically used to save data persistently. There's a number of different mechanisms that Android provides to support persistence. One mechanism provided by Android are shared preferences, which are used to store private primitive data in key value pairs using a Java hash map whose contents are stored persistently in a file. There's also something called external storage, which is used to store public data on a shared external storage mechanism. There's also internal storage, which is internal to an app, and this is used to store private data on the device memory. And there's also something called SQLight Databases, which we'll talk about later in this MOOC, and they're used to store structured data in a private database. Android Linux supports secondary storage by it's virtual file system or VSF framework. Each file system VFS is implemented via a kernel module it registers the operations that it supports with VFS. These operations include things like open, close, read, write, select, and so on. Many Android Linux file systems supports flash meteor files that can be erased and programmed electronically. This is the end of the overview on the Android Linux Kernel giving a brief description of its primary and secondary storage mechanisms. [MUSIC]