SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Linux Audio Conference 2011
            May 6-8th, Maynooth




   Low-Latency Audio on Linux
by Means of Real-Time Scheduling


 Tommaso Cucinotta, Dario Faggioli, Giacomo Bagnoli
         Cucinotta,
           Real-Time Systems Lab (RETIS)
       Scuola Superiore Sant'Anna, Pisa (Italy)
Motivations and background
Problem Presentation
    General-Purpose Operating Systems
       Very effective for storing & managing multimedia contents

       Designed for
           • average-case performance

           • serving applications on a best-effort basis

       They are not the best candidate for serving real-time
        applications with tight timing constraints
           • like real-time multimedia
           • or computing with precise QoS assurance


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 3
Possible Solutions

    Overcoming limitations of a GPOS for multimedia
       Large buffers used to compensate unpredictability
           • ==> poor real-time interactivity and no low-latency multimedia
       One-application one-system paradigm
           • For example, for low-latency real-time audio processing (jack),
             gaming, CD/DVD burning, plant control, etc...
       POSIX real-time extensions
           • Priority-based, no temporal isolation
           • Not appropriate for deploying the multitude of (soft) real-time
             applications populating the systems of tomorrow
       Linux Real-Time Throttling extension
           • Designed for limiting, not guaranteeing



Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 4
POSIX
                     Real-Time Scheduling
 Multi-queue priority-based scheduler
 Processes at same priority
       Round-Robin (SCHED_RR)
       FIFO (SCHED_FIFO)
                                                          Max RT Prio
       Sporadic Server                                         …
        (see later)
                                                                                      CPU
                                                                                      CPU
                                      Process
                                                          Min RT Prio


                                                          Non RT




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 5
Traditional RT Systems
                   (and Priority Scheduling)
    All deadlines respected as far as system behaves
    as foreseen at design time
       Traditional (C, T) task model
           • C: Worst-Case Execution Time (WCET)
           • T: Minimum inter-arrival period

    Admission Control, e.g., for RM:

                                                                              ~83.3%
   High priority
   (2, 6)                                                                     Overall
                                                                       t      Load

   Low priority
   (4, 8)
                                                                        t
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 6
Problems of
                        Priority Scheduling
    High-priority processes may indefinitely delay
    low-priority ones
       Coherent with the typical real-time/embedded scenario
           • Higher-priority processes are more important (e.g., safety critical)



                                              bad job
                                                                              ~83.3%
   High priority
   (2, 6)                                                                     Overall
                                                                       t      Load
                                                                            deadline missed
   Low priority                                                               by good job
   (4, 8)
                                                                        t
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 7
Problems of
                        Priority Scheduling
    High-priority processes may indefinitely delay
    low-priority ones
       Coherent with the typical real-time/embedded scenario
           • Higher-priority processes are more important (e.g., safety critical)
       What if processes have same importance/criticality ?
                                              bad job
                                                                              ~83.3%
   High priority
   (2, 6)                                                                     Overall
                                                                       t      Load
                                                                            deadline missed
   Low priority                                                               by good job
   (4, 8)
                                                                        t
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 8
Recently Proposed
                   Real-Time Scheduler(s)
    Features (schedulers implement)
       Temporal isolation among tasks and task groups
       Need for provisioning of reservation parameters
        (sporadic real-time task model)
           • runtime every period
           • Optional allowance to use more CPU if available (soft reservations)
       Simple admission control scheme
           • May be disabled if custom user-space policy needed
           • Optional over-subscription possibility
             with graceful, controlled management of overloads
       Priority-based, Deadline-based, mixed scheduling
       Hierarchical scheduling
           • Attach more tasks as a whole to a single reservation
           • Nesting of groups and subgroups at arbitrary levels

Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 9
Recently proposed schedulers
                   and their APIs
    AQuoSA EDF-based scheduler
    EDF RT Throttling (a.k.a., The IRMOS Scheduler)
       Parameters: runtime, period, cpu mask, tasks
           • RT priorities of real-time tasks
       cgroup-based interface
           • Problem of atomic changes to scheduling parameters
    SCHED_SPORADIC
       Parameters: runtime, period, priority, low-priority
       POSIX standard system call: sched_setscheduler()
           • Breaks binary interface & compatibility
       Alternative system call: sched_setscheduler_ex()
    SCHED_DEADLINE
       Parameters: runtime, period, flags
       system call: sched_setscheduler_ex()
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 10
Programming Paradigm
    SCHED_DEADLINE
         struct sched_param_ex sp = {
           .sched_runtime = runtime_ts;   // struct timespec
           .sched_deadline = deadline_ts; // struct timespec
           .flags = 0;
         };
         sched_setscheduler_ex(pid, SCHED_DEADLINE, &sp);
         /* Now you get runtime_ts every deadline_ts guaranteed */




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 11
Programming Paradigm
                                    IRMOS Scheduler
       Pre-requisite at run-time: mount cgroups
          mkdir /cg
          mount -t cgroup -o cpu,cpuacct cgroup /cg
       Reduce runtime for root-level tasks
          echo 200000 > /cg/cpu.rt_rt_task_runtime_us
           (root-group runtime remains at default of 950000)
       Create group, with reservation of 10ms every 100ms
            mkdir /cg/g1
            echo 100000 > /cg/g1/cpu.rt_period_us
            echo 10000 > /cg/g1/cpu.rt_runtime_us
            echo 100000 > /cg/g1/cpu.rt_task_period_us
            echo 10000 > /cg/g1/cpu.rt_task_runtime_us
       Attach task with tid=1421
          echo 1421 > /cg/g1/tasks
       Detach task
          echo 1421 > /cg/tasks
       Attach process with pid=1700
          for tid in `ls /proc/1700/task`; do echo $tid > /cg/g1/tasks; done
       Destroy group
          rmdir /cg/g1


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore
Programming Paradigm
                   IRMOS Scheduler with AQuoSA API

    AQuoSA
         qres_params_t p = (qres_params_t) {
           .Q = 10000,
           .Q_min = 10000,
           .P = 40000,
           .flags = 0
         };
         if (qres_create_server(&params, &sid) == QOS_OK) {
           qres_attach_task(sid, 0, 0);
           /* Now we get 10ms every 40ms guaranteed */
         }



Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 13
Using resource reservations

  (and deadline-based scheduling)

in the Jack low-latency infrastructure
Our Work
    We modified Jack so as to
       Use a deadline-based real-time scheduling policy
       With automatic tuning of scheduling parameters
           • Period computed on the basis of the cycle duration/deadline
           • Budget computed through a feedback-based loop
       With minimum changes to the Jack daemon and library
       Without any change required to applications/clients
    We measured the obtained performance
       No performance drop when running alone
       Performance is kept despite other real-time workload


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 15
Jack Periodic Cycle
    Arbitrary complex DAG of computations




                                                                               Output
        Input                                                                  driver
        driver




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 16
Jack Periodic Cycle
    Arbitrary complex DAG of computations
    All computations must complete within the cycle




                                                                               Output
        Input                                                                  driver
        driver




                                                                  t
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 17
Jack Periodic Cycle
    Arbitrary complex DAG of computations
    All computations must complete within the cycle
    Each computation belongs to a different process


                                                                               Output
        Input                                                                  driver
        driver

                                Jack Rack            JackEq
                                  GUI                 GUI


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 18
Jack Periodic Cycle
    All client threads attached to a single reservation




                                                                               Output
        Input                  Resource Reservation
                                                                               driver
        driver

                                Jack Rack            JackEq
                                  GUI                 GUI


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 19
Jack Periodic Cycle
    All client threads attached to a single reservation
    Budget identified by feedback-based scheduling




                               Resource Reservation


                 (Q, P)

                                       Controller

Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 20
Controller
    Percentile estimator
       Can be configured to estimate a percentile (can be 100%)
        of the observed consumed budget distribution over a
        moving window
    Additional heuristics
       Addition of a safety threshold (over-provision)
       Temporary budget boost on new client
       Temporary budget boost on xrun
           • (prevents further xrun from occurring after an xrun)




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 21
Problems
    Still we could see some xruns
       Some workload peaks cannot be foreseen
           • e.g., MPEG decoding or MIDI synthesizer




    Solution
       Use soft resource reservations
           • Tasks are allowed to run beyond budget exhaustion
           • The budget is still a minimum guarantee for the tasks
       We used the SHRUB algorithm
           • Fair redistribution of unused bandwidth to active RT tasks
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 22
Experimental Results
Testbed set-up
    Hardware
       Processor: Intel E8400 @ 3GHz
       Sound Card: Terratec EWX24/96 PCI
    Software
       Linux Kernel: 2.6.29
       RT Scheduler: POSIX and AQuoSA scheduler
       Workload: jack and rt-app
       rt-app parameters: 5ms every 40ms




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 24
Jack @ 1333 us
                       96 kHz, 128 samples




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 25
Jack @ 1333 us
                       96 kHz, 128 samples




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 26
Concluding Remarks
    Summarizing
       We tackled a challenging case-study for using
        resource reservations in Linux
       We modified Jack to use a deadline scheduler
       The critical issue was budget identification
       The performance of Jack alone doesn't get worse
       The set-up and deployment of a complex mix of real-time
        applications is simplified
           • Each one declares its own timing requirements




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 27
Future Work
    This work is far from being finished
       Better handling of budget boost for new clients
       Collaboration from clients with very dynamic workloads
           • e.g., MIDI synthesizer
       Use a more recent scheduler
       Experiment with the PREEMPT_RT version of the deadline
        scheduler
       Experiment with SMP and parallelization




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 28
Related Publications
          Hierarchical Multiprocessor CPU Reservations for the Linux
           Kernel
           F. Checconi, T. Cucinotta, D. Faggioli, G. Lipari
           OSPERT 2009, Dublin, Ireland, June 2009
          An EDF Scheduling class for the Linux kernel
           D. Faggioli, F. Checconi, M. Trimarchi, C. Scordino
           RTLWS 2009, Dresden, October 2009
          Access Control for Adaptive Reservations on Multi-User Systems
           T. Cucinotta
           RTAS 2008, St. Louis, MO, United States, April 2008
          Self-tuning Schedulers for Legacy Real-Time Applications
           T. Cucinotta, F. Checconi, L. Abeni, L. Palopoli
           EuroSys 2010, Paris, April 2010
          Respecting temporal constraints in virtualised services
           T. Cucinotta, G. Anastasi, L. Abeni
           RTSOAA 2009, Seattle, Washington, July 2009
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore
Thanks for your attention




                                    Questions?



      http://retis.sssup.it/people/tommaso

Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 30
Deadline-based Scheduling
  for Temporal Isolation
        in Linux
Deadline-based Scheduling
    Optimum for single-processor systems
       Necessary and sufficient admission control test
        for simple task model:


    Same problems of PS
       Deadlines respected as far as the WCETs are respected
       Things may go bad when
           • One or more tasks exhibit higher computation times than foreseen
           • One or more tasks behaves differently than foreseen
                – e.g., it blocks on a critical section for more than foreseen
       The task that suffers may not be the misbehaving one
    Cannot provide Temporal Isolation unless . . .
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 32
Real-time theory

    Reservation-based scheduling: (Qi, Pi)
       “Qi time units guaranteed on a CPU every Pi time units”


          (5, 9)                                                              ~88.9%
                                                                  t           Overall
                                                                              Load
          (2, 6)
                                                                  t
       Independently of how others behave
        (temporal isolation)


Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 33
Temporal Isolation

    Enforcement of temporal isolation
       Not only EDF scheduling
                                              bad job

          (5, 9)
                                                                        t
                                                                            deadline missed
                                                                              by good job
          (2, 6)
                                                                        t




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 34
Temporal Isolation

    Enforcement of temporal isolation
       Once budget exhausted, delay to next activation period
                                                                            Deadline missed
                                              bad job                         by bad job

          (5, 9)
                                                                                       t

          (2, 6)
                                                                                       t




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 35
Temporal Isolation

    Is needed despite blocks/unblocks
       Not only EDF scheduling
                                          block     unblock


          (5, 9)
                                                                    t
                                                                        deadline-miss

          (2, 6)
                                                                    t




Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 36
Temporal Isolation

    Is needed despite blocks/unblocks
       Not only EDF scheduling
                                          block     unblock


          (5, 9)
                                                                           t

          (2, 6)
                                                                           t
    See the “unblock rule” of the Constant Bandwidth
    Server (CBS, Abeni '98)

Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 37
POSIX Sporadic Server
    SCHED_SS
       Provides a form of temporal isolation
       Parameters: (Q, P, RT Priority, Low RT Priority)
       Budget exhausted => lower the priority till next recharge
       For every time interval in which the task executes, post a
        recharge of budget equal to the consumed CPU time one
        period apart 2             2       1    1

                 (2, 6)

                 current
                 budget

    SCHED_SS may be analysed using FP techniques
       Patching the standard for getting rid of the “bug”
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 38
IRMOS RT Scheduler
                    Design Goals

    Replace real-time throttling
    Tight integration in Linux kernel
         Modification to the Linux RT scheduler
    Reuse as many Linux features as
    possible
         Management of task hierarchies and
          scheduling parameters via cgroups
         POSIX compatibility and API
    Efficient for SMP
         Independent runqueues
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore
IRMOS Scheduler

          Slice the available computing power into
          reservations




  CPU 0
  CPU 1
  CPU 2
  CPU 3

Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore
Hierarchical Scheduling

                                                                               EDF
                                                                               EDF
                                          Max RT Prio
                                                …
                                                                     FP
                                                                     FP                   FP
                                                                                          FP


                                          Min RT Prio           T1
                                                                T1        T2
                                                                          T2         T3
                                                                                     T3        T4
                                                                                               T4

    Needed operations
       create & destroy reservations
       attach & detach tasks ↔ reservations
       list tasks attached to reservations (and list reservations)
       Standard operations: get & set parameters
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 41
Other Features
    Warning: features & parameters may easily grow
       Addition of parameters, such as
           • deadline
           • desired vs guaranteed runtime (for adaptive reservations)
       Set of flags for controlling variations on behaviour
           •   work conserving vs non-conserving reservations
           •   what happens at fork() time
           •   what happens on tasks death (automatic reclamation)
           •   notifications from kernel (e.g., runtime exhaustion)
       Controlled access to RT scheduling by unprivileged
        applications (e.g., per-user “quotas”)
       Monitoring (e.g., residual runtime, available bandwidth)
       Integration/interaction with power management
Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna
                                                                        © 2007 Scuola Superiore 42

Weitere ähnliche Inhalte

Was ist angesagt?

Real Time Systems & RTOS
Real Time Systems & RTOSReal Time Systems & RTOS
Real Time Systems & RTOSVishwa Mohan
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos conceptsanishgoel
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systemsknowdiff
 
Real time operating-systems
Real time operating-systemsReal time operating-systems
Real time operating-systemskasi963
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating SystemsRohit Joshi
 
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagnesarankumar4445
 
Real time-system
Real time-systemReal time-system
Real time-systemysush
 
Hard versus Soft real time system
Hard versus Soft real time systemHard versus Soft real time system
Hard versus Soft real time systemKamal Acharya
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsAJAL A J
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsAditya Vichare
 
RTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstRTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstStefano Bragaglia
 
Components in real time systems
Components in real time systemsComponents in real time systems
Components in real time systemsSaransh Garg
 
RTOS- Real Time Operating Systems
RTOS- Real Time Operating Systems RTOS- Real Time Operating Systems
RTOS- Real Time Operating Systems Bayar shahab
 
Reference model of real time system
Reference model of real time systemReference model of real time system
Reference model of real time systemKamal Acharya
 

Was ist angesagt? (20)

Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
Real Time Systems & RTOS
Real Time Systems & RTOSReal Time Systems & RTOS
Real Time Systems & RTOS
 
Rtos concepts
Rtos conceptsRtos concepts
Rtos concepts
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
 
Real time operating-systems
Real time operating-systemsReal time operating-systems
Real time operating-systems
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
 
Real Time System
Real Time SystemReal Time System
Real Time System
 
RTOS
RTOSRTOS
RTOS
 
Real time-system
Real time-systemReal time-system
Real time-system
 
Hard versus Soft real time system
Hard versus Soft real time systemHard versus Soft real time system
Hard versus Soft real time system
 
Real time systems 1 and 2
Real time systems 1 and 2Real time systems 1 and 2
Real time systems 1 and 2
 
Real-Time Scheduling Algorithms
Real-Time Scheduling AlgorithmsReal-Time Scheduling Algorithms
Real-Time Scheduling Algorithms
 
Real Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded SystemsReal Time Operating Systems for Embedded Systems
Real Time Operating Systems for Embedded Systems
 
RTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstRTAI - Earliest Deadline First
RTAI - Earliest Deadline First
 
Components in real time systems
Components in real time systemsComponents in real time systems
Components in real time systems
 
RTOS- Real Time Operating Systems
RTOS- Real Time Operating Systems RTOS- Real Time Operating Systems
RTOS- Real Time Operating Systems
 
Periodic
PeriodicPeriodic
Periodic
 
Reference model of real time system
Reference model of real time systemReference model of real time system
Reference model of real time system
 
P341 dijkstra
P341 dijkstraP341 dijkstra
P341 dijkstra
 

Andere mochten auch

Optimum Scalability Point for Parallelisable Real-Time Components
Optimum Scalability Point for Parallelisable Real-Time ComponentsOptimum Scalability Point for Parallelisable Real-Time Components
Optimum Scalability Point for Parallelisable Real-Time Componentstcucinotta
 
The Wizard of OS: a Heartbeat for Legacy Multimedia Applications
The Wizard of OS: a Heartbeat for Legacy Multimedia ApplicationsThe Wizard of OS: a Heartbeat for Legacy Multimedia Applications
The Wizard of OS: a Heartbeat for Legacy Multimedia Applicationstcucinotta
 
Virtualised e-Learning with Real-Time Guarantees on the IRMOS Platform
Virtualised e-Learning with Real-Time Guarantees on the IRMOS PlatformVirtualised e-Learning with Real-Time Guarantees on the IRMOS Platform
Virtualised e-Learning with Real-Time Guarantees on the IRMOS Platformtcucinotta
 
SLAs in Virtualized Cloud Computing Infrastructures with QoS Assurance
SLAs in Virtualized Cloud Computing Infrastructures with QoS AssuranceSLAs in Virtualized Cloud Computing Infrastructures with QoS Assurance
SLAs in Virtualized Cloud Computing Infrastructures with QoS Assurancetcucinotta
 
Improving Responsiveness for Virtualized Networking Under Intensive Computing...
Improving Responsiveness for Virtualized Networking Under Intensive Computing...Improving Responsiveness for Virtualized Networking Under Intensive Computing...
Improving Responsiveness for Virtualized Networking Under Intensive Computing...tcucinotta
 

Andere mochten auch (6)

Optimum Scalability Point for Parallelisable Real-Time Components
Optimum Scalability Point for Parallelisable Real-Time ComponentsOptimum Scalability Point for Parallelisable Real-Time Components
Optimum Scalability Point for Parallelisable Real-Time Components
 
The Wizard of OS: a Heartbeat for Legacy Multimedia Applications
The Wizard of OS: a Heartbeat for Legacy Multimedia ApplicationsThe Wizard of OS: a Heartbeat for Legacy Multimedia Applications
The Wizard of OS: a Heartbeat for Legacy Multimedia Applications
 
Virtualised e-Learning with Real-Time Guarantees on the IRMOS Platform
Virtualised e-Learning with Real-Time Guarantees on the IRMOS PlatformVirtualised e-Learning with Real-Time Guarantees on the IRMOS Platform
Virtualised e-Learning with Real-Time Guarantees on the IRMOS Platform
 
Real-Time API
Real-Time APIReal-Time API
Real-Time API
 
SLAs in Virtualized Cloud Computing Infrastructures with QoS Assurance
SLAs in Virtualized Cloud Computing Infrastructures with QoS AssuranceSLAs in Virtualized Cloud Computing Infrastructures with QoS Assurance
SLAs in Virtualized Cloud Computing Infrastructures with QoS Assurance
 
Improving Responsiveness for Virtualized Networking Under Intensive Computing...
Improving Responsiveness for Virtualized Networking Under Intensive Computing...Improving Responsiveness for Virtualized Networking Under Intensive Computing...
Improving Responsiveness for Virtualized Networking Under Intensive Computing...
 

Ähnlich wie Low-Latency Audio on Linux by Means of Real-Time Scheduling

Self-tuning Schedulers for Legacy Real-Time Applications
Self-tuning Schedulers for Legacy Real-Time ApplicationsSelf-tuning Schedulers for Legacy Real-Time Applications
Self-tuning Schedulers for Legacy Real-Time Applicationsguestbbe1c83
 
pptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfpptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfJaganBehera8
 
presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)chetan mudenoor
 
Virtual Network Functions as Real-Time Containers in Private Clouds
Virtual Network Functions as Real-Time Containers in Private CloudsVirtual Network Functions as Real-Time Containers in Private Clouds
Virtual Network Functions as Real-Time Containers in Private Cloudstcucinotta
 
Modeling and simulation of power consumption and execution times for real-tim...
Modeling and simulation of power consumption and execution times for real-tim...Modeling and simulation of power consumption and execution times for real-tim...
Modeling and simulation of power consumption and execution times for real-tim...tcucinotta
 
Embedded Intro India05
Embedded Intro India05Embedded Intro India05
Embedded Intro India05Rajesh Gupta
 
Real-Time Operating Systems Real-Time Operating Systems RTOS .ppt
Real-Time Operating Systems Real-Time Operating Systems RTOS .pptReal-Time Operating Systems Real-Time Operating Systems RTOS .ppt
Real-Time Operating Systems Real-Time Operating Systems RTOS .pptlematadese670
 
Bertrand Delsart Java R T S
Bertrand Delsart Java R T SBertrand Delsart Java R T S
Bertrand Delsart Java R T Sdeimos
 
Introduction to Scheduling
Introduction to SchedulingIntroduction to Scheduling
Introduction to Schedulingpec2013
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 

Ähnlich wie Low-Latency Audio on Linux by Means of Real-Time Scheduling (20)

Self-tuning Schedulers for Legacy Real-Time Applications
Self-tuning Schedulers for Legacy Real-Time ApplicationsSelf-tuning Schedulers for Legacy Real-Time Applications
Self-tuning Schedulers for Legacy Real-Time Applications
 
Rt kernel-prn
Rt kernel-prnRt kernel-prn
Rt kernel-prn
 
pptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdfpptonrtosbychetan001-140213003314-phpapp02.pdf
pptonrtosbychetan001-140213003314-phpapp02.pdf
 
Rtos Concepts
Rtos ConceptsRtos Concepts
Rtos Concepts
 
presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)presentation on real time operating system(RTOS's)
presentation on real time operating system(RTOS's)
 
Virtual Network Functions as Real-Time Containers in Private Clouds
Virtual Network Functions as Real-Time Containers in Private CloudsVirtual Network Functions as Real-Time Containers in Private Clouds
Virtual Network Functions as Real-Time Containers in Private Clouds
 
Modeling and simulation of power consumption and execution times for real-tim...
Modeling and simulation of power consumption and execution times for real-tim...Modeling and simulation of power consumption and execution times for real-tim...
Modeling and simulation of power consumption and execution times for real-tim...
 
Rtos 8051
Rtos 8051Rtos 8051
Rtos 8051
 
Event Scheduling
Event SchedulingEvent Scheduling
Event Scheduling
 
Real Time Operating System
Real Time Operating SystemReal Time Operating System
Real Time Operating System
 
rtos.ppt
rtos.pptrtos.ppt
rtos.ppt
 
Pharos
PharosPharos
Pharos
 
Embedded Intro India05
Embedded Intro India05Embedded Intro India05
Embedded Intro India05
 
Real-Time Operating Systems Real-Time Operating Systems RTOS .ppt
Real-Time Operating Systems Real-Time Operating Systems RTOS .pptReal-Time Operating Systems Real-Time Operating Systems RTOS .ppt
Real-Time Operating Systems Real-Time Operating Systems RTOS .ppt
 
ESC UNIT 3.ppt
ESC UNIT 3.pptESC UNIT 3.ppt
ESC UNIT 3.ppt
 
Bertrand Delsart Java R T S
Bertrand Delsart Java R T SBertrand Delsart Java R T S
Bertrand Delsart Java R T S
 
Introduction to Scheduling
Introduction to SchedulingIntroduction to Scheduling
Introduction to Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Scheduling
SchedulingScheduling
Scheduling
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 

Kürzlich hochgeladen

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Kürzlich hochgeladen (20)

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Low-Latency Audio on Linux by Means of Real-Time Scheduling

  • 1. Linux Audio Conference 2011 May 6-8th, Maynooth Low-Latency Audio on Linux by Means of Real-Time Scheduling Tommaso Cucinotta, Dario Faggioli, Giacomo Bagnoli Cucinotta, Real-Time Systems Lab (RETIS) Scuola Superiore Sant'Anna, Pisa (Italy)
  • 3. Problem Presentation General-Purpose Operating Systems  Very effective for storing & managing multimedia contents  Designed for • average-case performance • serving applications on a best-effort basis  They are not the best candidate for serving real-time applications with tight timing constraints • like real-time multimedia • or computing with precise QoS assurance Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 3
  • 4. Possible Solutions Overcoming limitations of a GPOS for multimedia  Large buffers used to compensate unpredictability • ==> poor real-time interactivity and no low-latency multimedia  One-application one-system paradigm • For example, for low-latency real-time audio processing (jack), gaming, CD/DVD burning, plant control, etc...  POSIX real-time extensions • Priority-based, no temporal isolation • Not appropriate for deploying the multitude of (soft) real-time applications populating the systems of tomorrow  Linux Real-Time Throttling extension • Designed for limiting, not guaranteeing Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 4
  • 5. POSIX Real-Time Scheduling Multi-queue priority-based scheduler Processes at same priority  Round-Robin (SCHED_RR)  FIFO (SCHED_FIFO) Max RT Prio  Sporadic Server … (see later) CPU CPU Process Min RT Prio Non RT Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 5
  • 6. Traditional RT Systems (and Priority Scheduling) All deadlines respected as far as system behaves as foreseen at design time  Traditional (C, T) task model • C: Worst-Case Execution Time (WCET) • T: Minimum inter-arrival period Admission Control, e.g., for RM: ~83.3% High priority (2, 6) Overall t Load Low priority (4, 8) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 6
  • 7. Problems of Priority Scheduling High-priority processes may indefinitely delay low-priority ones  Coherent with the typical real-time/embedded scenario • Higher-priority processes are more important (e.g., safety critical) bad job ~83.3% High priority (2, 6) Overall t Load deadline missed Low priority by good job (4, 8) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 7
  • 8. Problems of Priority Scheduling High-priority processes may indefinitely delay low-priority ones  Coherent with the typical real-time/embedded scenario • Higher-priority processes are more important (e.g., safety critical)  What if processes have same importance/criticality ? bad job ~83.3% High priority (2, 6) Overall t Load deadline missed Low priority by good job (4, 8) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 8
  • 9. Recently Proposed Real-Time Scheduler(s) Features (schedulers implement)  Temporal isolation among tasks and task groups  Need for provisioning of reservation parameters (sporadic real-time task model) • runtime every period • Optional allowance to use more CPU if available (soft reservations)  Simple admission control scheme • May be disabled if custom user-space policy needed • Optional over-subscription possibility with graceful, controlled management of overloads  Priority-based, Deadline-based, mixed scheduling  Hierarchical scheduling • Attach more tasks as a whole to a single reservation • Nesting of groups and subgroups at arbitrary levels Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 9
  • 10. Recently proposed schedulers and their APIs AQuoSA EDF-based scheduler EDF RT Throttling (a.k.a., The IRMOS Scheduler)  Parameters: runtime, period, cpu mask, tasks • RT priorities of real-time tasks  cgroup-based interface • Problem of atomic changes to scheduling parameters SCHED_SPORADIC  Parameters: runtime, period, priority, low-priority  POSIX standard system call: sched_setscheduler() • Breaks binary interface & compatibility  Alternative system call: sched_setscheduler_ex() SCHED_DEADLINE  Parameters: runtime, period, flags  system call: sched_setscheduler_ex() Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 10
  • 11. Programming Paradigm SCHED_DEADLINE struct sched_param_ex sp = { .sched_runtime = runtime_ts; // struct timespec .sched_deadline = deadline_ts; // struct timespec .flags = 0; }; sched_setscheduler_ex(pid, SCHED_DEADLINE, &sp); /* Now you get runtime_ts every deadline_ts guaranteed */ Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 11
  • 12. Programming Paradigm IRMOS Scheduler Pre-requisite at run-time: mount cgroups  mkdir /cg  mount -t cgroup -o cpu,cpuacct cgroup /cg Reduce runtime for root-level tasks  echo 200000 > /cg/cpu.rt_rt_task_runtime_us (root-group runtime remains at default of 950000) Create group, with reservation of 10ms every 100ms  mkdir /cg/g1  echo 100000 > /cg/g1/cpu.rt_period_us  echo 10000 > /cg/g1/cpu.rt_runtime_us  echo 100000 > /cg/g1/cpu.rt_task_period_us  echo 10000 > /cg/g1/cpu.rt_task_runtime_us Attach task with tid=1421  echo 1421 > /cg/g1/tasks Detach task  echo 1421 > /cg/tasks Attach process with pid=1700  for tid in `ls /proc/1700/task`; do echo $tid > /cg/g1/tasks; done Destroy group  rmdir /cg/g1 Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore
  • 13. Programming Paradigm IRMOS Scheduler with AQuoSA API AQuoSA qres_params_t p = (qres_params_t) { .Q = 10000, .Q_min = 10000, .P = 40000, .flags = 0 }; if (qres_create_server(&params, &sid) == QOS_OK) { qres_attach_task(sid, 0, 0); /* Now we get 10ms every 40ms guaranteed */ } Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 13
  • 14. Using resource reservations (and deadline-based scheduling) in the Jack low-latency infrastructure
  • 15. Our Work We modified Jack so as to  Use a deadline-based real-time scheduling policy  With automatic tuning of scheduling parameters • Period computed on the basis of the cycle duration/deadline • Budget computed through a feedback-based loop  With minimum changes to the Jack daemon and library  Without any change required to applications/clients We measured the obtained performance  No performance drop when running alone  Performance is kept despite other real-time workload Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 15
  • 16. Jack Periodic Cycle Arbitrary complex DAG of computations Output Input driver driver Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 16
  • 17. Jack Periodic Cycle Arbitrary complex DAG of computations All computations must complete within the cycle Output Input driver driver t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 17
  • 18. Jack Periodic Cycle Arbitrary complex DAG of computations All computations must complete within the cycle Each computation belongs to a different process Output Input driver driver Jack Rack JackEq GUI GUI Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 18
  • 19. Jack Periodic Cycle All client threads attached to a single reservation Output Input Resource Reservation driver driver Jack Rack JackEq GUI GUI Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 19
  • 20. Jack Periodic Cycle All client threads attached to a single reservation Budget identified by feedback-based scheduling Resource Reservation (Q, P) Controller Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 20
  • 21. Controller Percentile estimator  Can be configured to estimate a percentile (can be 100%) of the observed consumed budget distribution over a moving window Additional heuristics  Addition of a safety threshold (over-provision)  Temporary budget boost on new client  Temporary budget boost on xrun • (prevents further xrun from occurring after an xrun) Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 21
  • 22. Problems Still we could see some xruns  Some workload peaks cannot be foreseen • e.g., MPEG decoding or MIDI synthesizer Solution  Use soft resource reservations • Tasks are allowed to run beyond budget exhaustion • The budget is still a minimum guarantee for the tasks  We used the SHRUB algorithm • Fair redistribution of unused bandwidth to active RT tasks Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 22
  • 24. Testbed set-up Hardware  Processor: Intel E8400 @ 3GHz  Sound Card: Terratec EWX24/96 PCI Software  Linux Kernel: 2.6.29  RT Scheduler: POSIX and AQuoSA scheduler  Workload: jack and rt-app  rt-app parameters: 5ms every 40ms Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 24
  • 25. Jack @ 1333 us 96 kHz, 128 samples Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 25
  • 26. Jack @ 1333 us 96 kHz, 128 samples Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 26
  • 27. Concluding Remarks Summarizing  We tackled a challenging case-study for using resource reservations in Linux  We modified Jack to use a deadline scheduler  The critical issue was budget identification  The performance of Jack alone doesn't get worse  The set-up and deployment of a complex mix of real-time applications is simplified • Each one declares its own timing requirements Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 27
  • 28. Future Work This work is far from being finished  Better handling of budget boost for new clients  Collaboration from clients with very dynamic workloads • e.g., MIDI synthesizer  Use a more recent scheduler  Experiment with the PREEMPT_RT version of the deadline scheduler  Experiment with SMP and parallelization Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 28
  • 29. Related Publications  Hierarchical Multiprocessor CPU Reservations for the Linux Kernel F. Checconi, T. Cucinotta, D. Faggioli, G. Lipari OSPERT 2009, Dublin, Ireland, June 2009  An EDF Scheduling class for the Linux kernel D. Faggioli, F. Checconi, M. Trimarchi, C. Scordino RTLWS 2009, Dresden, October 2009  Access Control for Adaptive Reservations on Multi-User Systems T. Cucinotta RTAS 2008, St. Louis, MO, United States, April 2008  Self-tuning Schedulers for Legacy Real-Time Applications T. Cucinotta, F. Checconi, L. Abeni, L. Palopoli EuroSys 2010, Paris, April 2010  Respecting temporal constraints in virtualised services T. Cucinotta, G. Anastasi, L. Abeni RTSOAA 2009, Seattle, Washington, July 2009 Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore
  • 30. Thanks for your attention Questions? http://retis.sssup.it/people/tommaso Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 30
  • 31. Deadline-based Scheduling for Temporal Isolation in Linux
  • 32. Deadline-based Scheduling Optimum for single-processor systems  Necessary and sufficient admission control test for simple task model: Same problems of PS  Deadlines respected as far as the WCETs are respected  Things may go bad when • One or more tasks exhibit higher computation times than foreseen • One or more tasks behaves differently than foreseen – e.g., it blocks on a critical section for more than foreseen  The task that suffers may not be the misbehaving one Cannot provide Temporal Isolation unless . . . Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 32
  • 33. Real-time theory Reservation-based scheduling: (Qi, Pi)  “Qi time units guaranteed on a CPU every Pi time units” (5, 9) ~88.9% t Overall Load (2, 6) t  Independently of how others behave (temporal isolation) Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 33
  • 34. Temporal Isolation Enforcement of temporal isolation  Not only EDF scheduling bad job (5, 9) t deadline missed by good job (2, 6) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 34
  • 35. Temporal Isolation Enforcement of temporal isolation  Once budget exhausted, delay to next activation period Deadline missed bad job by bad job (5, 9) t (2, 6) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 35
  • 36. Temporal Isolation Is needed despite blocks/unblocks  Not only EDF scheduling block unblock (5, 9) t deadline-miss (2, 6) t Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 36
  • 37. Temporal Isolation Is needed despite blocks/unblocks  Not only EDF scheduling block unblock (5, 9) t (2, 6) t See the “unblock rule” of the Constant Bandwidth Server (CBS, Abeni '98) Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 37
  • 38. POSIX Sporadic Server SCHED_SS  Provides a form of temporal isolation  Parameters: (Q, P, RT Priority, Low RT Priority)  Budget exhausted => lower the priority till next recharge  For every time interval in which the task executes, post a recharge of budget equal to the consumed CPU time one period apart 2 2 1 1 (2, 6) current budget SCHED_SS may be analysed using FP techniques  Patching the standard for getting rid of the “bug” Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 38
  • 39. IRMOS RT Scheduler Design Goals Replace real-time throttling Tight integration in Linux kernel Modification to the Linux RT scheduler Reuse as many Linux features as possible Management of task hierarchies and scheduling parameters via cgroups POSIX compatibility and API Efficient for SMP Independent runqueues Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore
  • 40. IRMOS Scheduler Slice the available computing power into reservations CPU 0 CPU 1 CPU 2 CPU 3 Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore
  • 41. Hierarchical Scheduling EDF EDF Max RT Prio … FP FP FP FP Min RT Prio T1 T1 T2 T2 T3 T3 T4 T4 Needed operations  create & destroy reservations  attach & detach tasks ↔ reservations  list tasks attached to reservations (and list reservations)  Standard operations: get & set parameters Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 41
  • 42. Other Features Warning: features & parameters may easily grow  Addition of parameters, such as • deadline • desired vs guaranteed runtime (for adaptive reservations)  Set of flags for controlling variations on behaviour • work conserving vs non-conserving reservations • what happens at fork() time • what happens on tasks death (automatic reclamation) • notifications from kernel (e.g., runtime exhaustion)  Controlled access to RT scheduling by unprivileged applications (e.g., per-user “quotas”)  Monitoring (e.g., residual runtime, available bandwidth)  Integration/interaction with power management Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna Sant’Anna © 2007 Scuola Superiore 42