3 Preface Preface describes importance of embedded system and operating system details knowledge for embedded system engineer, and in which areas this handbook with Benu could help. Benu is a collection of increments that uses step by step presentation of core operating system operations, data structures and algorithms, where each new increment brings only a few new subjects. Other educational operating systems, while presenting single topic still use complete system, highlighting related elements from it. In Benu, using increments student can focus better on subjects introduced in that increment, and thus simplify learning process of otherwise very complex system. With increments we can also present the evolution of operating system components, starting with basic functionality in one increment, and then adding extended functionalities, as they become needed. Beside operating system topics, using Benu in education might improve other skills required for embedded system development, including advanced usage of C programming language, experience with development and debugging tools and methods, and familiarization with POSIX for real-time and embedded systems.

4 1. Introduction In introduction an overview of embedded systems and operating systems is given. Furthermore, possible software designs used in implementation are discussed. Finally, properties of an controlling task are detailed.

5 2. Development environment and tools Second section presents layered operating system architecture with Benu as example. Development tools used to create and modify Benu are introduced (GNU tools mostly).

6 3. Building stand-alone system Creating operating system is very different than creating programs for existing operating system. Operating system must take control of system, initialize its components and provide interface for programs and users. Difference does not come only on operational level, but also on development environment. In this section, an basic system ( hello world ) is created and explained: from source files, development tools, running and debugging in simulated environment.

7 4. Source tree Bigger projects (like operating system source) have many source files. How to arrange them into directories depends on the project. For operating system source, commonly used directory structure reflects layered architecture (hardware abstraction layer, kernel layer, interfaces to programs) and subsystems. Benu uses layers for directory tree, which is presented in this chapter. Compiling and linking ( building system ) is usually defined with Makefile scripts. There are several conventions for placing compiled and linked files object files (define through Makefiles). They are discussed in this chapter and one used in Benu is detailed.

8 5. Interrupts Interrupts are mechanisms for handling asynchronous events from input-output (IO) devices. Why are they needed, how are they handled in most processors is shortly explained in this chapter. Details how are interrupts handled in x86 architecture is also presented. Finally, what an IO subsystem must provide is detailed and shown on subsystem implemented in Benu.

9 6. Dynamic memory management Dynamic memory management is required for kernel operations (for descriptors, buffers, stacks and heaps for threads) and for programs (using heap). Some data structures may be statically allocated, but more flexibility is achieved with dynamic management. For real time and embedded systems algorithms for dynamic memory must have certain properties: speed, efficiency (minimal fragmentation) and predictability (O(1) complexity preferred). Several algorithms for dynamic memory management are presented, while those implemented in Benu are detailed.

10 7. Time management Time management subsystem must provide operations for activities (in text called alarms ) that must be started on exact time. Those activities may be asynchronous ( programmed ), performing other jobs in the meantime, or synchronous when application is delayed until given time. Benu implements time management with POSIX interface. Operations include clock manipulation ( get and set ), delay and alarm (one time or periodic). Implementation principles for mentioned operations are described, while those implemented in Benu are detailed (including POSIX interface).

11 8. Devices Handling interrupts from IO devices requires interrupt handling but also device drivers. In this chapter an simple device driver interface is presented and its usage demonstrated on implementations (in Benu) for display, keyboard and serial port drivers.

12 9. Command shell Simple command shell is implemented in Benu. Possibilities for creating and starting custom programs using shell or directly (with definitions through Makefile) is presented in this chapter.

13 10. Multithreading This chapter discuss on multithreading topics: when is multithreading required, what are its benefits and drawbacks. Implementing multithreading requires a lot of effort, changes and new operations in system (e.g. scheduling, synchronization and communication). All those topics are discussed and multithreading implementation in Benu is shown and analyzed.

14 11. Processes Protecting kernel and other programs from faulty (or malicious) ones is required for some systems. Protection mechanisms are discussed in this chapter with emphasis on separating memory for each program into separate process. Processes are in Benu implemented using segmentation ability of x86 processors. Although not implemented, paging is also discussed.

15 12. Choosing operating system for embedded computers Previous chapters describe operating system components, their internals and Benu implementation details. However, many embedded systems may be based on COTS or free operating systems as base. In this chapter some of such systems are presented and analyzed. Most basic principle in many such projects is compromise on required features and price. Somewhere will cheap systems be satisfactory, somewhere an hard RTOS must be used while elsewhere an combination of operating systems (for each node) will be adequate.

16 Appendix A. Development tools: installing, virtual machine settings, Git usage example First appendix shortly presents steps for creating development environment (including tools for compiling, linking, running in emulator). Since most larger project are created by a team (more than one person), an source control (revision control) tool is presented (which is used for students projects on Benu).

17 Appendix B. Special C keywords and macros Creating software for embedded system requires many optimizations (speed, size, placement) for which deeper knowledge of programming language is required. In this appendix some useful C keywords and macros are explained (mostly on examples from Benu or in simplified forms).

18 Appendix C. Linker script examples Embedded system memory usually consists of ROM and RAM. How to compile systems that should have some of its parts present in ROM while other should be loaded in RAM is usually defined through linker scripts. In this appendix two more system examples are presented which with appropriate scripts.

20 Appendix E. Adding schedulers: RR and EDF Priority scheduler is most basic scheduler widely used in embedded and real-time systems. Benu in its core implements priority scheduler with FIFO queues for ready threads with same priority. However, this scheduler can be extend with support for other schedulers. This appendix present an idea and its implementation in Benu with round-robin and earliest-deadline-first schedulers as examples.

University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011 Department Mission The Department of Computer Science in the College of Arts and Sciences

Introduction to Operating Systems Indiana University Chen Yu Perspective of the Computer System Software A general piece of software with common functionalities that support many applications. Example:

Review from last time CS 537 Lecture 3 OS Structure What HW structures are used by the OS? What is a system call? Michael Swift Remzi Arpaci-Dussea, Michael Swift 1 Remzi Arpaci-Dussea, Michael Swift 2

Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may

Operating Systems 4 th Class Lecture 1 Operating Systems Operating systems are essential part of any computer system. Therefore, a course in operating systems is an essential part of any computer science

General Computer Architecture I/O Management COMP755 Advanced Operating Systems Goals for I/O Users should access all devices in a uniform manner. Devices should be named in a uniform manner. The OS, without

COMPUTER SCIENCE COMSC The computer science department offers courses in three general areas, each targeted to serve students with specific needs: 1. General education students seeking a computer literacy

Operating System Tutorial OPERATING SYSTEM TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Operating System Tutorial An operating system (OS) is a collection

Lecture Outline Operating Systems Objectives Describe the functions and layers of an operating system List the resources allocated by the operating system and describe the allocation process Explain how

S Jerry Breecher 2: OS Structures 1 Structures What Is In This Chapter? System Components System Calls How Components Fit Together Virtual Machine 2: OS Structures 2 SYSTEM COMPONENTS These are the pieces

Objectives To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system Chapter 2: Operating-System Structures

BELONGS TO THE CYGNUS SOLUTIONS founded about 1989 initiative connected with an idea of free software ( commercial support for the free software ). Recently merged with RedHat. CYGNUS was also the original

How do Users and Processes interact with the Operating System? Users interact indirectly through a collection of system programs that make up the operating system interface. The interface could be: A GUI,

Computer Science 4302 Operating Systems Student Learning Outcomes 1. The student will learn what operating systems are, what they do, and how they are designed and constructed. The student will be introduced

NEC Storage Software Performance Monitoring User s Manual IS025-15E NEC Corporation 2003-2010 No part of the contents of this book may be reproduced or transmitted in any form without permission of NEC

Application note SPC56ELxx Automotive MCU multicore architectures and getting started Introduction This document provides an introduction to the world of multi-core MCU architectures and programming and

Computer Organization & Architecture Lecture #19 Input/Output The computer system s I/O architecture is its interface to the outside world. This architecture is designed to provide a systematic means of

A Comparison of Distributed Systems: ChorusOS and Amoeba Angelo Bertolli Prepared for MSIT 610 on October 27, 2004 University of Maryland University College Adelphi, Maryland United States of America Abstract.

Data Management for Portable Media Players Table of Contents Introduction...2 The New Role of Database...3 Design Considerations...3 Hardware Limitations...3 Value of a Lightweight Relational Database...4

Operating System for the K computer Jun Moroo Masahiko Yamada Takeharu Kato For the K computer to achieve the world s highest performance, Fujitsu has worked on the following three performance improvements

223 Design and Implementation of the Heterogeneous Multikernel Operating System Yauhen KLIMIANKOU Department of Computer Systems and Networks, Belarusian State University of Informatics and Radioelectronics,

ERIKA Enterprise pre-built Virtual Machine with support for Arduino, STM32, and others Version: 1.0 July 2, 2014 About Evidence S.r.l. Evidence is a company operating in the field of software for embedded

Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

Computer Engineering Unit Value 3.0 (typically 180 hours for a full-time course) This standard unit is primarily for use by the Technical Institutes when operating the following Courses : Diploma in Computer

I/O Input/Output One of the functions of the OS, controlling the I/O devices Wide range in type and speed The OS is concerned with how the interface between the hardware and the user is made The goal in

True / False Questions: Chapter 7 Memory Management 1. T / F In a multiprogramming system, main memory is divided into multiple sections: one for the operating system (resident monitor, kernel) and one

Lecture 1 Operating System Overview What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. The Major Objectives of an Operating system

VCU 1 COMPUTER SCIENCE, BACHELOR OF SCIENCE (B.S.) The Bachelor of Science in Computer Science is built on a rigorous, highly concentrated, accredited curriculum of computer science courses. The program