A POSIX-Ada Interface for Application-Defined Scheduling



Similar documents
Predictable response times in event-driven real-time systems

How To Extend The Frescor Distributed Transaction Manager (Dtm) With A Multi-Node Transaction Manager

Implementing and Using Execution Time Clocks in Ada Hard Real-Time Applications

Execution-Time Clocks and Ravenscar Kernels

Comparison between scheduling algorithms in RTLinux and VxWorks

Tasks Schedule Analysis in RTAI/Linux-GPL

Programming real-time systems with C/C++ and POSIX

Task Attribute-Based Scheduling - Extending Ada s Support for Scheduling

Integrating real-time analysis into design flows

AFDX networks. Computers and Real-Time Group, University of Cantabria

Experience with the integration of distribution middleware into partitioned systems

Design Patterns in C++

SYSTEM ecos Embedded Configurable Operating System

First-class User Level Threads

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

Performance Comparison of RTOS

Real- Time Scheduling

Predictable response times in eventdriven real-time systems

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

Resource Reservation & Resource Servers. Problems to solve

A Periodic Events - For the Non- Scheduling Server

ARINC-653 Inter-partition Communications and the Ravenscar Profile

Middleware. Peter Marwedel TU Dortmund, Informatik 12 Germany. technische universität dortmund. fakultät für informatik informatik 12

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

4. Fixed-Priority Scheduling

Lecture 3 Theoretical Foundations of RTOS

Enhancing the Monitoring of Real-Time Performance in Linux

Quality of Service su Linux: Passato Presente e Futuro

MAST: A Timing Behavior Model for Embedded Systems Design Processes

Execution-time control for interrupt handling

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

Real-Time Scheduling 1 / 39

A Survey of Fitting Device-Driver Implementations into Real-Time Theoretical Schedulability Analysis

Embedded Systems. 6. Real-Time Operating Systems

Dispatching Domains for Multiprocessor Platforms and their Representation in Ada

Why Threads Are A Bad Idea (for most purposes)

CPU Scheduling. CPU Scheduling

CS414 SP 2007 Assignment 1

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

Survey of software architectures: function-queue-scheduling architecture and real time OS

Modular Real-Time Linux

Ada Real-Time Services and Virtualization

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

QoS and Communication Performance Management

AFDX Emulator for an ARINC-based Training Platform. Jesús Fernández Héctor Pérez J. Javier Gutiérrez Michael González Harbour

ICS Principles of Operating Systems

CPU Scheduling Outline

Lecture 25 Symbian OS


Safe Kernel Scheduler Development with Bossa

Processor Scheduling. Queues Recall OS maintains various queues

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

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Using NSM for Event Notification. Abstract. with DM3, R4, and Win32 Devices

Cloud Operating Systems for Servers

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

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

Extending RTAI/Linux with Fixed-Priority Scheduling with Deferred Preemption

Operating System Aspects. Real-Time Systems. Resource Management Tasks

Linux Scheduler. Linux Scheduler

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Run-Time Scheduling Support for Hybrid CPU/FPGA SoCs

WINDOWS CE 5.0 ON AN X86 PLATFORM

LynxOS RTOS (Real-Time Operating System)

Using EDF in Linux: SCHED DEADLINE. Luca Abeni

POSIX : Certified by IEEE and The Open Group a briefing.

Scheduling and Thread Management with RTEMS

Linux A multi-purpose executive support for civil avionics applications?

QoS Parameters. Quality of Service in the Internet. Traffic Shaping: Congestion Control. Keeping the QoS

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

Schedulability analysis of distributed real-time systems

REAL TIME OPERATING SYSTEMS. Lesson-10:

Expansion of a Framework for a Data- Intensive Wide-Area Application to the Java Language

REAL TIME OPERATING SYSTEMS. Lesson-18:

Aperiodic Task Scheduling

Real-Time Operating Systems.

Modelling and analysing real-time systems with MAST: Overview and future extensions

Thread Synchronization and the Java Monitor

Scheduling Aperiodic and Sporadic Jobs in Priority- Driven Systems

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

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

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Computer Networks. Chapter 5 Transport Protocols

Overview of the Linux Scheduler Framework

OS OBJECTIVE QUESTIONS

Scalability evaluation of barrier algorithms for OpenMP

Real Time Programming: Concepts

Quality of Service in the Internet. QoS Parameters. Keeping the QoS. Traffic Shaping: Leaky Bucket Algorithm

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

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

Shared Address Space Computing: Programming

A data-centric event-oriented RTOS for MCUs - simplify multithreaded programming and boost performance

sel4: from Security to Safety Gernot Heiser, Anna Lyons NICTA and UNSW Australia

Periodic Task Scheduling

Operating Systems and Networks

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

Chapter 6, The Operating System Machine Level

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

Transcription:

A POSIX-Ada Interface for Application-Defined Scheduling By: Mario Aldea Rivas Michael González Harbour (aldeam@unican.es) (mgh@unican.es) Ada-Europe 2002 Vienna, Austria, June 17-21, 2002 4 GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 1

Table of Contents 1. Overview 2. Motivation 3. Some Requirements 4. Model Description 5. Scheduling Events 6. Scheduling Actions 7. Example of an Application-Defined Policy: EDF 8. MaRTE OS 9. Performance 10.Conclusions and Further Work GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 2

1. Overview Interface for Application-Defined Scheduling Integrated into the POSIX-Ada bindings POSIX: Portable Operating System Interface standard Not only an interface Requires support in the operating system kernel Implemented in our operating system MaRTE OS Main points Application-defined scheduling policies implemented by a special kind of tasks (scheduler tasks) Scheduler tasks can activate or suspend other tasks GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 3

2. Motivation The scheduling policies defined in Ada and POSIX are not sufficient for all application environments Dynamic priorities allow better use of resources Dynamic systems require flexible scheduling schemes (multimedia) There are many policies based on dynamic priorities It is not possible to standardize them all Our proposal: Allow applications to define their own scheduling policies and synchronization protocols GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 4

3. Some Requirements Allow a large variety of scheduling policies Compatibility with current scheduling policies in POSIX and Ada Coexistence of several scheduling algorithms Isolation of critical tasks from behavior of application schedulers Integration of synchronization protocols to avoid priority inversion or similar effects GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 5

4. Model Description Planificada Applicationpor Scheduled la Aplic. Task Application Scheduler Task Thread Normal Thread Regular Normal Task User Address Space System Scheduler Planificada por Planificada Application- la Aplic. por Scheduled la Aplic. Task Scheduler Address Space Application Scheduler Task GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 6

Model Description (Cont d) Scheduler tasks are always invoked before their scheduled tasks - They inherit all the priorities inherited by them - Schedulers have precedence if same priority Schedulers can activate or suspend any of their tasks, and must accept (or reject) them at creation They are notified about events related to their scheduled tasks Application Scheduler Activate or Suspend Scheduling Events Queue Planificada Planificada por Application- la Aplic. por Scheduled la Aplic. Tasks GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 7

Model Description (Cont d) System Mutex Planificada Planificada por Applicationla Aplic. por Scheduled la Aplic. Task Application Mutex Application Scheduler Thread Thread Normal Regular Normal Task System Mutex System Mutex Planificada Planificada por Application- la Aplic. por Scheduled la Aplic. Task Application Mutex Application Scheduler GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 8

5. Scheduling Events They represent situations relevant to the application scheduler They contain the following information Type of event Task that caused the event Event-dependent information: - Inherited priority - Involved application mutex - Signal received - Application-specific information Events may be filtered by type GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 9

Scheduling Events (Cont d) Scheduling event type NEW_TASK TERMINATE_TASK READY BLOCK YIELD SIGNAL CHANGE_SCHED_PARAM EXPLICIT_CALL TIMEOUT Additional information none none none none none POSIX signal information none Application message none GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 10

Scheduling Events (Cont d) Scheduling event type PRIORITY_INHERIT PRIORITY_UNINHERIT INIT_MUTEX DESTROY_MUTEX LOCK_MUTEX TRYLOCK_MUTEX UNLOCK_MUTEX BLOCK_AT_MUTEX CHANGE_MUTEX_SCHED_PARAM Additional information Inherited system priority Uninherited system priority Pointer to the app. mutex Pointer to the app. mutex Pointer to the app. mutex Pointer to the app. mutex Pointer to the app. mutex Pointer to the app. mutex Pointer to the app. mutex GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 11

6. Scheduling Actions Schedulers have an operation (Execute_Actions) to request execution of multiple actions, including: accept or reject a task that has requested attachment activate or suspend a task accept or reject initialization of an application mutex grant the lock on an application mutex As part of Execute_Actions, the scheduler suspends until: the next scheduling event, arrival of a POSIX signal (usually indicating expiration of regular or CPU-time timers) or the expiration of a timeout GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 12

Execute Actions procedure Execute_Actions (Sched_Actions : in Scheduling_Actions; Set : in POSIX_Signals.Signal_Set; Event : out Scheduling_Event; Timeout : in POSIX.Timespec; Current_Time : out POSIX.Timespec) -- other overloaded versions exist Structure of a scheduler: Execute actions and wait for event Determine actions to execute according to received event GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 13

7. Example of an Application- Defined Policy: EDF Application scheduled task: with POSIX_Application_Scheduling; package AppSched renames POSIX_Application_Scheduling;... package EDF_Policy is new AppSched.Application_Defined_Policy (EDF_Parameters);... task body Periodic_EDF_Task is Param : EDF_Parameters := (Deadline, Period); begin EDF_Policy.Change_Task_Policy (EDF_Scheduler_Task_Id, Param); loop -- do useful work...; -- task will wait until the next period AppSched.Invoke_Scheduler; end loop; end Periodic_EDF_Task; GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 14

Example of an Application-Defined Policy: EDF (Cont d) Application Scheduler task: task body EDF_Scheduler is...; Most_Urgent_Task : Task_Id; Now, Earliest_Start : POSIX.Timespec; Event : AppSched.Scheduling_Event; Sched_Actions : AppSched.Scheduling_Actions; begin AppSched.Become_An_Application_Scheduler; AppSched.Set_Clock(Clock_Realtime); AppSched.Set_Flags(Absolute_Timeout); Now := POSIX_Timers.Get_Time(Clock_Realtime); -- Scheduling events processing loop loop Schedule_Next(Most_Urgent_Task, Earliest_Start); GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 15

Example of an Application-Defined policy: EDF (Cont d) if Most_Urgent_Task /= Null_Task_Id then AppSched.Add_Activate (Sched_Actions, Most_Urgent_Task); end case; AppSched.Execute_Actions_with_Timeout (Sched_Actions, Event, Earliest_Start); -- process scheduling events case AppSched.Get_Event_Code(Event) is when New_Task => if Schedulability_Test (AppSched.Get_Task(Event)) then AppSched.Add_Accept (Sched_Actions, AppSched.Get_Task(Event)); Add_To_List_of_Tasks (AppSched.Get_Task(Event), Now); else AppSched.Add_Reject (Sched_Actions, AppSched.Get_Task(Event)); end if; when Terminate_Task => Eliminate_From_List_of_Tasks (AppSched.Get_Task(Event)); GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 16

Example of an Application-Defined policy: EDF (Cont d) when Ready => Make_Active (AppSched.Get_Task (Event)); when Block => Make_Blocked (AppSched.Get_Task (Event)); when Explicit_Call => AppSched.Add_Suspend (Sched_Actions, AppSched.Get_Task (Event)); Make_Timed (AppSched.Get_Task (Event)); when Timeout => null; when Others => null; end case; end loop; -- Scheduling events processing loop end EDF_Scheduler; GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 17

MaRTE OS Minimal Real-Time OS for Embedded Applications Follows the POSIX.13 Minimum Realtime System Profile - Single process - No file system Adds new POSIX interfaces: CPU-time Timers Written in Ada, with few parts in C or assembly language Gnat run-time system runs on top of it POSIX threads interface for C threads Usable both for C and Ada (and mixed) applications Free software http://marte.unican.es GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 18

Performance on a 1.1GHz Pentium III Context switches in Ada Scheduling Algorithm Context switch (µs) Overhead for a 1KHz task Regular Ada delay until statement 5 1% Round robin within priorities 4.5 0.9% Constant Bandwidth Server 6 1.2% GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 19

Conclusions and Further Work APIs for application scheduling in Ada and C Performance is acceptable Great flexibility Compatible with previous fixed priority scheduling Implemented in MaRTE OS Future work POSIX standardization Integration into the Ada language - will require some language extensions (pragmas,...), specially for protected objects GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 20

GRUPO DE COMPUTADORES Y TIEMPO REAL Mario Aldea Rivas 21