SYSTEM ecos Embedded Configurable Operating System



Similar documents
Computer-System Architecture

An Implementation Of Multiprocessor Linux

A Survey of Parallel Processing in Linux

Operating Systems. Lecture 03. February 11, 2013

Operating Systems 4 th Class

Porting ecos to the Analog Devices BLACKfin DSP

Linux scheduler history. We will be talking about the O(1) scheduler

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Linux Scheduler. Linux Scheduler

First-class User Level Threads

Introduction. What is an Operating System?

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

Operating Systems Overview

Red Hat Linux Internals

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Have both hardware and software. Want to hide the details from the programmer (user).

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Performance Comparison of RTOS

1. Computer System Structure and Components

Chapter 2: OS Overview

Master of Engineering Thesis. Evaluation and Implementation of the RTOS ecos

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Embedded Systems. 6. Real-Time Operating Systems

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

EECE 276 Embedded Systems

Scaling Networking Applications to Multiple Cores

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Real Time Programming: Concepts

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Processes and Non-Preemptive Scheduling. Otto J. Anshus

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

Chapter 11 I/O Management and Disk Scheduling

Chapter 6, The Operating System Machine Level

The Real-Time Operating System ucos-ii

Chapter 3: Operating-System Structures. Common System Components

Linux Driver Devices. Why, When, Which, How?

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Overview of Operating Systems Instructor: Dr. Tongping Liu

Real-Time Operating Systems.

REAL TIME OPERATING SYSTEMS. Lesson-10:

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Tasks Schedule Analysis in RTAI/Linux-GPL

Real-Time Scheduling 1 / 39

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Cortex-A9 MPCore Software Development

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Embedded Parallel Computing

RTEMS Porting Guide. On-Line Applications Research Corporation. Edition , for RTEMS July 2015

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

Chapter 2 Process, Thread and Scheduling

RTOS Debugger for ecos

CHAPTER 15: Operating Systems: An Overview

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

the high-performance embedded kernel User Guide Version 5.0 Express Logic, Inc Toll Free 888.THREADX FAX

OPERATING SYSTEMS STRUCTURES

How To Write A Multi Threaded Software On A Single Core (Or Multi Threaded) System

CS161: Operating Systems

Kernel Optimizations for KVM. Rik van Riel Senior Software Engineer, Red Hat June

Shared Address Space Computing: Programming

The Microsoft Windows Hypervisor High Level Architecture

Chapter 1 Computer System Overview

Real-Time Operating Systems With Example PICOS18. What is an Operating System?

OS OBJECTIVE QUESTIONS

Facing the Challenges for Real-Time Software Development on Multi-Cores

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Keil C51 Cross Compiler

OPERATING SYSTEMS Internais and Design Principles

Linux Process Scheduling Policy

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

What is best for embedded development? Do most embedded projects still need an RTOS?

Outline of this lecture G52CON: Concepts of Concurrency

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Comparing RTOS to Infinite Loop Designs

Exception and Interrupt Handling in ARM

Linux 2.4. Linux. Windows

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Effective Computing with SMP Linux

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203

Chapter 13 Embedded Operating Systems

Hardware accelerated Virtualization in the ARM Cortex Processors

Achieving Nanosecond Latency Between Applications with IPC Shared Memory Messaging

Real-time Operating Systems. VO Embedded Systems Engineering Armin Wasicek

VxWorks Guest OS Programmer's Guide for Hypervisor 1.1, 6.8. VxWorks GUEST OS PROGRAMMER'S GUIDE FOR HYPERVISOR

Process Scheduling in Linux

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

CS414 SP 2007 Assignment 1

Mutual Exclusion using Monitors

CSC 2405: Computer Systems II

Going Linux on Massive Multicore

Real Time Operating System for Embedded DSP Applications

Transcription:

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 developer of CYGWIN, a collection of free software tools to allow various versions of WINDOWS to act similar to a UNIX system (and try to satisfy POSIX norms). ecos IS DEVELOPED FOR EMBEDDED PROCESSORS VERY HETEROGENOUS SET OF PROCESSORS, OFTEN OF LIMITED RESOURCES. ecos IS DESIGNED AS HIGHLY CONFIGURABLE, WITH HARDWARE LAYER AS ABSTRACTED AS POSSIBLE. DEVELOPERS HAVE FULL ACCESS TO THE ENTIRE SOFTWARE SOURCE CODE. INTSTALLABLE VERSIONS ARE AVAILABLE FOR A WIDE VARIETY OF PRODUCTS The system is in form of PACKAGES. Even the KERNEL is a package. IT IS THE KEY PACKAGE, however OPTIONAL! (it is possible to design an application a single threaded application which does not use any kernel functionality). 1/14

KERNEL FUNCTIONALITY: - NEW THREAD CREATION (at startup or when the system is running) - CONTROL OF THREADS AND PRIORITY MANIPULATION - SCHEDULER POLICY SELECTION - SYNCHRONIZATION OF THREADS WITH A HELP OF WIDE RANGE OF TOOLS - HANDLING OF INTERRUPTS AND EXCEPTIONS The ecos kernel DOES NOT provide memory allocation functions or device drivers. The memory allocation is handled by a separate package. Device drivers are separated from the ecos kernel to satisfy the postulate of the maximal hardware abstraction. One can design a single threaded application which DOES NOT use kernel functionality (kernel package) at all but still profit from other packages of the ecos. Typically, such polling loop organization of a thread permanently checks all device flags and takes relevant actions to service I/O requirements. Any amount of calculation in each iteration increases the delay between events, eventually leading to an error. Some advanced packages (e.g. TCP/IP stack) require multi-treading internally and then the kernel package is NOT optional. 2/14

SCHEDULERS: Schedulers are needed when system serves multiple threads. ecos kernel may run one of two schedulers: BITMAP scheduler and Multi-Level Queue scheduler (MLQ). Both use simple numerical priorities. The default range of priority levels is 32. That can be changed by the CYGNUM_KERNEL_SCHED_PRIORITIES option. Level 0 is the highest priority. BITMAP scheduler allows for one and only one thread per priority level. For the default case it means that the system may be configured with the 32 threads maximum. BITMAP scheduler keeps track of threads which are currently runnable, identifies the one with the highest priority and similarly cares for those waiting for synchronization (semaphore, mutex or other primitive). Such indexing is simple and fast. BITMAP scheduler does not support timeslicing so, consequently, the current thread can not be preempted in favour of another thread with the same priority. This makes the BITMAP scheduler totally deterministic. 3/14

SCHEDULERS (cont.): MLQ scheduler allows to configure the system with multiple threads with the same priority. There is no limit on the number of threads in the system then. Other limitations e.g. available memory are, of course, possible. MLQ scheduler supports TIMESLICING, which is controlled by options, like CYGSEM_KERNEL_SCHED_TIMESLICE CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS When active, the scheduler automatically switches from one runnable thread to another one with the same priority after some number of clock ticks. Timeslicing is operational only when there are two runnable threads with the same priority and no runnable one with the higher priority. Timeslicing can be disabled and then the thread will not be preempted. It continue running until explicitly yields the control to the processor or is blocked (e.g. waiting for mutex, semaphore..) 4/14

SCHEDULERS (MLQ cont.): The default behaviour of the MLQ scheduler when threads are blocked is that it uses the last-in-first-out queueing. It means that when several threads waits on the semaphore and one post is released then the woken up thread is the last one which called cyg_semaphore_wait function. That makes queueing and dequeueing fast but if waiting threads are of different priorities then the first woken up thread may not be the one with the highest priority. The option CYGIMP_KERNEL_SCHED_SORTED_QUEUE, when enabled, allows to require the strict priority queueing. SYNCHRONIZATION PRIMITIVES: mutexes condition variables counting semaphores mail boxes event flags 5/14

SYNCHRONIZATION PRIMITIVES (CONT.): MUTEXES have a distinguished function in ecos: allow safe share of resources by multiple threads. The mutex is locked by the thread which manipulates the shared resource and then unlocks the mutex again. The other primitives are used for communication between threads or DSRs with the ISR or DSR with the thread itself. CONDITION VARIABLE can be used by a thread which has locked a mutex but needs to wait for some condition to become true. A thread WAITS ON condition variable until another thread or DSR (Deffered Service Routine) use to wake it up. N.B. when thread waits on Condition Variable it releases the mutex (before waiting) and reacquires it before processing. That is of delicate matter as it is important that no race conditions are introduced. Atomic operations and great care is needed! A COUNTING SEMAPHORE is used when one needs to communicate that certain event has ocuured, or that it has occurred multiple times in succession. The waiting thread is called the consumer thread while the thread (or DSR) which posts the event is called the producer. 6/14

SYNCHRONIZATION PRIMITIVES (CONT.): The count associated with the semaphore records occurrence of multiple events, which are not lost and allow for succession of multiple wait operations. MAIL BOXES similarly indicate occurrence of a particular event and at the same time allow to exchange some data item (often it is a pointer to some structure). The mail box has finite capacity and if producer generates mail box events faster than they are consumed then the mail box is blocked. Such feature usually eliminates mail boxes as a synchronization tools for the DSR thread communication. They are typically used as a synchronization between threads. EVENT FLAGS are used to wait for (from the one hand side) or to signal (from the other) various events. For such communication one uses usually a bit masks, in which given bits are associated with particular events. With such simple construct there is no way to deal with multiple events as in the case of counting semaphores. Similarly, unlike mail boxes, there is no way to pass any additional data. On the other hand one can use event flags for communication between DSR and threads as there is no danger of an overflow and a subsequent blockade. 7/14

INTERRUPT HANDLING: Treads and interrupt handlers interactions. - continuous polling of a volatile variable - polling on every clock tick (10 ms) - use of some synchronization primitive Problem with possible kernel data corruption. ecos two-level approach to interrupt handling: ISR and DSR. ISR fast Interrupt Service Routine direct response to a Interrupt Vector Efficient service with minimal references to the system leaving the rest of the service to DSR Deferred Service Routine which completes the interrupt service which may require much more system calls (via e.g. using condition variables or by posting a semaphores. It is also DSR which is supposed to contact the thread (e.g. to wake it up) There are practices of disabling interrupts preventing the ISR from running rather bad practise and should be used only for a very short periods of time and only for really necessary actions (like manipulating list of free buffers... 8/14

INTERRUPT HANDLING (cont.): Somehow similar problem to the question of interrupts being enabled or disabled - is the problem of the kernel scheduler lock. Scheduler may be locked in response to function like: cyg_mutex_lock cyg_semaphore_post which may be issued by the kernel for time of manipulation with some data structures after which the lock is released. Locking the scheduler may cause pending some DSRs and some chain of synchronization events influencing waking up of threads of various priorities.... various possible scenarios... in which one can illustrate that the two-level approach to interrupt handling realised by ecos allows fo safe solutions (.. e.g. it is safer to leave cyg_semaphore_post to a DSR rather than to ISR which disabling interrupts may cause corruption of kernel data structure or even loss of some thread that would never run again). 9/14

SMP ( Symmetric Multiprocessing Systems) SUPPORT (available only on some selected architectures and platforms) - The main startup takes place on only one CPU ( primary CPU) - All other CPUs are either suspended or captured by HAL - Primary CPU after some initializations calls cyg_start to enter the application - Secondary CPUs are initialized ONLY when an application calls cyg_scheduler_start (this routine scans the list of available secondary CPUs and invokes HAL_SMP_CPU_START to start each CPU and then calls an internall function Cyg_Scheduler::start_cpu to enter the Scheduler for the primary CPU) - Each secondary CPU starts in the HAL, completes initialization at calls kernel at cyg_kernel_cpu_startup, claims the scheduler lock and calls Cyg_Scheduler::start_cpu, which is common for all CPUs. Now an interrupt object Is installed for inter-cpu interrupts and after that all CPU are equal. (Some hardware may still distinguish them delivering interrupts) 10/14

HAL Hardware Abstraction Layer ecos is written mostly in C++ - HAL: in C and assembler BASE DEFINITIONS ARCHITECTURE CHARACTERISATION INTERRUPT HANDLING CLOCK AND TIMERS HAL I/O CACHE CONTROL BASE: e.g. endianness (bit ordering), label translation, type definitions, ARCHITECTURE: register save format, thread context initialisation and switching, stack sizes, address translation, INTERRUPT HANDLING: vector numbers, interrupt state control, ISR/VSR management, CLOCK and TIMERS: clock control, delay routines, clock frequency control, HAL I/O: register address, register read, register write CACHE CONTROL: cache dimension, global control synchronize, write, lock, unlock... 11/14