Springer-Verlag London 2014
Alan Holt and Chi-Yu Huang Embedded Operating Systems Undergraduate Topics in Computer Science 10.1007/978-1-4471-6603-0_1
1. Introduction
Most people are familiar with general purpose computing devices, such as desktops and laptops. Their use is common-place and support a wide variety of applications, many of which involve a wider access to distributed applications over the Internet (electronic mail, social media etc). Users interact with general purpose computers directly through keyboards, mice and monitor screens. There are many consumer devices, such as mobile phones, tablet computers and satellite navigation devices, that are classified as embedded devices. They support user interaction through touch screens, microphones, audio speakers and accelerometers.
Nevertheless, many embedded systems operate in the background with little or no direct human interaction. Embedded computer systems are used extensively throughout our technological society.
As we look to the future we should contemplate an Internet-of-things (IoT). IoT predicts the attachment of computing devices (with network capabilities) to objects . The attributes of such an object can be monitored and digitised by its associated computing device which then relayed (over a network) to remote system for analysis.
A precursor to the Internet-of-things is smart energy metering like that of 3E-Houses []. Energy monitoring devices were installed in social housing to record energy consumption in domestic homes. The data was transmitted over the Internet to central database. This data was analysed and fed back to the participants of the project to increase their awareness of their energy usage. The hope was, that through this feedback mechanism, people would reduce their energy consumption and CO2 footprint.
1.1 An Overview of Operating Systems
Operating systems are software components dedicated to the management of the computer systems hardware. Most computer systems (embedded or otherwise) operate under the control of an operating system. Unix-like operating systems, such as GNU/Linux, comprise a kernel, software libraries and a number of utility programs. The diagram in Fig .
Fig. 1.1
Operating system overview
The kernel is a program that manages the resources of a computer system, It allocates these resources between separate process in a controlled way. Processes are computer programs under execution and may be initiated by different users. Resources are, therefore, not just allocated amongst processes, but also amongst users. What distinguishes the kernel from the rest of the operating system software, is the processor privilege level the respective code is executed. Most modern processors support multiple privilege levels. Intel 386 processors, for example, support four privilege levels. GNU/Linux only uses two, level 0 (the most privileged) for the executing kernel code and level 3 (least privileged) for running user code.
The reason for these different privilege levels is to prevent user code from directly accessing certain hardware resources. For example, I/O port instructions can only be accessed by kernel code. Clearly, user processes require access of computer systems peripheral devices (I/O port instructions). A process can context switch into kernel mode by issuing a software trap. In kernel mode, a process can access hardware via the kernels own subsystems. Access to hardware is, therefore, controlled by the kernel. Functions of the kernel can be characterised below:
Process management Computer systems store a number of programs in their memory. These programs may be part of the operating systems utilities or software written by a user as an application. A program under execution is called a process . The system may execute multiple processes concurrently. The process management system gives the illusion of processes running simultaneously, typically by giving each process a time slice of the CPU (or CPUs). A scheduler makes the decision as to which process is allocated a time slice. A process may have its execution suspended and resumed several times before it terminates.
Memory management Memory management is a complex function. In order to manage memory efficiently and effectively, the kernel implements virtual memory . Virtual memory gives appearance that a process has more memory than it actually has (or even, more than the entire system has). The virtual and physical memory are divided into pages . With paged memory, a virtual address is divided into two parts, namely, a virtual page frame number plus an offset into the page. When a virtual memory location is referenced, the virtual page frame is translated into a physical page frame number. The offset is then used to identify the specific memory location within the page.
Filesystem Persistent data is stored in files which in turn, are organised in directories. The filesystem provides the functions and data structures required to manage files and directories (as well as other files objects) within a disk partition.
Device management In addition to the CPU and main memory, a computer system will comprise a variety of peripheral devices. For example, disk drives, network interfaces, input/output devices etc. Device drivers are pieces of software within the kernel that control the devices.
1.2 Overview of Embedded Systems
Embedded systems are hard to define. The problem lies in the fact there are exceptions to any rules one may conceive of. While it is not easy to find a characteristic that is exclusive to embedded systems we examine a few below:
A Subsystem of a device or machine Such systems are embedded within a more sophisticated device or machine, an engine management system of a car or microprocessor within an appliance, for example. Given this definition, one may view a general processing computer as being made up of a number of embedded systems. In addition to the CPU and main memory, general processing computers also include bus controllers, disk controllers, network interfaces and video controllers. All of which could be considered embedded systems in their own right. Furthermore, there are numerous non-subsystem examples of embedded systems, WiFi access-points, network routers, set-top boxes, for example.
Dedicated application Embedded system are largely designed to perform a specific task such as monitoring a temperature sensor or controlling a valve. In the case of consumer electronics, however, devices perform multiple tasks. Modern mobile phones are rarely limited to just making telephone calls. Many are described as smart phones and can support a plethora of applications. Given the increase in the power and sophistication of embedded devices it is difficult to distinguish them from general processing systems.
Small footprint A small footprint is a typical characteristic of embedded systems. This is usually driven by the task it has to perform.
Low power consumption : Many embedded systems are battery powered and therefore need to conserve energy consumption. Such systems may be static or mobile, either way they operate at a distance from any mains power. There are obvious exemptions to this rule. High speed routers and switches, for example, have powerful processors for forwarding high volumes of network packets. Consequently energy consumption will be high and mains supplied.