© 2013 Carnegie Mellon University Verifying Periodic Programs with Priority Inheritance Locks Sagar Chaki 1, Arie Gurfinkel 1, Ofer Strichman 2 FMCAD,

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

Carnegie Mellon University Software Engineering Institute CERT® Knowledgebase Copyright © 1997 Carnegie Mellon University VU#14202 UNIX rlogin with stack.
© 2013 Carnegie Mellon University UFO: From Underapproximations to Overapproximations and Back! Arie Gurfinkel (SEI/CMU) with Aws Albarghouthi and Marsha.
© 2006 Carnegie Mellon University Combining Predicate and Numeric Abstraction for Software Model Checking Software Engineering Institute Carnegie Mellon.
Deadlock and Starvation
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
© 2011 Carnegie Mellon University System of Systems V&V John B. Goodenough October 19, 2011.
© 2010 Carnegie Mellon University B OXES : A Symbolic Abstract Domain of Boxes Arie Gurfinkel and Sagar Chaki Software Engineering Institute Carnegie Mellon.
© 2013 Carnegie Mellon University Academy for Software Engineering Education and Training, 2013 Session Architect: Tony Cowling Session Chair: Nancy Mead.
© 2013 Carnegie Mellon University Measuring Assurance Case Confidence using Baconian Probabilities Charles B. Weinstock John B. Goodenough Ari Z. Klein.
© Carnegie Mellon University The CERT Insider Threat Center.
© 2011 Carnegie Mellon University Time Bounded Analysis of Real-Time Systems Arie Gurfinkel, Sagar Chaki, and Ofer Strichman Software Engineering Institute.
© 2012 Carnegie Mellon University Compositional Sequentialization of Periodic Programs Sagar Chaki 1, Arie Gurfinkel 1, Soonho Kong 2, Ofer Strichman 3.
© 2012 Carnegie Mellon University UFO: Verification with Interpolants and Abstract Interpretation Arie Gurfinkel and Sagar Chaki Software Engineering Institute.
© 2010 Carnegie Mellon University Acquisition Implications of SOA Adoption Software Engineering Institute Carnegie Mellon University Pittsburgh, PA
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
© 2015 Carnegie Mellon University Property Directed Polyhedral Abstraction Nikolaj Bjørner and Arie Gurfinkel VMCAI 2015.
© 2013 Carnegie Mellon University Static Analysis of Real-Time Embedded Systems with REK Arie Gurfinkel 1 joint work with Sagar Chaki 1, Ofer Strichman.
Ceng Operating Systems Chapter 2.4 : Deadlocks Process concept  Process scheduling  Interprocess communication  Deadlocks Threads.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© 2011 Carnegie Mellon University SPIN: Part Bug Catching: Automated Program Verification and Testing Sagar Chaki November 2, 2011.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© 2011 Carnegie Mellon University Should-Cost: A Use for Parametric Estimates Additional uses for estimation tools Presenters:Bob Ferguson (SEMA) Date:November.
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
© 2011 Carnegie Mellon University QUELCE: Quantifying Uncertainty in Early Lifecycle Cost Estimation Presenters:Dave Zubrow PhD Bob Ferguson (SEMA) Date:November.
UCDavis, ecs251 Fall /23/2007ecs251, fall Operating System Models ecs251 Fall 2007 : Operating System Models #3: Priority Inversion Dr. S.
Ipek Ozkaya, COCOMO Forum © 2012 Carnegie Mellon University Affordability and the Value of Architecting Ipek Ozkaya Research, Technology.
CS6133 Software Specification and Verification
Pallavi Joshi* Mayur Naik † Koushik Sen* David Gay ‡ *UC Berkeley † Intel Labs Berkeley ‡ Google Inc.
© 2014 Carnegie Mellon University Synthesizing Safe Bit-Precise Invariants Arie Gurfinkel (SEI / CMU) Anton Belov (UCD / Synopsys) Joao Marques-Silva (UCD)
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Author Software Engineering Institute
B. RAMAMURTHY 12/25/2015 Realtime System Fundamentals : Scheduling and Priority-based scheduling Pag e 1.
Copyright © Curt Hill Concurrent Execution An Overview for Database.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CrossCheckSimulation Results Conclusions References Model Instrumentation Modeling with CUTS Property Specification SPRUCE Challenge Problem Checking Model.
A presentation for Brian Evans’ Embedded Software Class By Nate Forman Liaison Technology Inc. 3/30/2000 For Real-Time Scheduling.
© 2015 Carnegie Mellon University Parametric Symbolic Reachability Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
© 2015 Carnegie Mellon University COCOMO 2015 November 17, 2015 Distribution Statement A: Approved for Public Release; Distribution is Unlimited Causal.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
RTAS 2014 Bounding Memory Interference Delay in COTS-based Multi-Core Systems Hyoseung Kim Dionisio de Niz Bj ӧ rn Andersson Mark Klein Onur Mutlu Raj.
1 CERT BFF: From Start To PoC June 09, 2016 © 2016 Carnegie Mellon University This material has been approved for public release and unlimited distribution.
Adding Concurrency to a Programming Language Peter A. Buhr and Glen Ditchfield USENIX C++ Technical Conference, Portland, Oregon, U. S. A., August 1992.
Process Management Deadlocks.
Secure Software Workforce Development Panel Session
Author Software Engineering Institute
Temporal Protection in Real-Time Systems
CSE 120 Principles of Operating
Michael Spiegel, Esq Timothy Shimeall, Ph.D.
Scheduling and Resource Access Protocols: Basic Aspects
Applied Operating System Concepts -
Metrics-Focused Analysis of Network Flow Data
Concurrency Specification
CS 143A – Winter 2013 Quiz 2 Solutions.
QUELCE: Quantifying Uncertainty in Early Lifecycle Cost Estimation
Lecture 2 Part 2 Process Synchronization
Verifying Periodic Programs with Priority Inheritance Locks
CSE 153 Design of Operating Systems Winter 2019
Distributed Dynamic Channel Allocation in Wireless Network
Presentation transcript:

© 2013 Carnegie Mellon University Verifying Periodic Programs with Priority Inheritance Locks Sagar Chaki 1, Arie Gurfinkel 1, Ofer Strichman 2 FMCAD, October 22, Software Engineering Institute, CMU 2 Technion, Israel Institute of Technology

2 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Copyright 2013 Carnegie Mellon University This material is based upon work funded and supported by the Department of Defense under Contract No. FA C-0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the United States Department of Defense. NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHEDON AN “AS-IS” BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. This material has been approved for public release and unlimited distribution except as restricted below. This material may be reproduced in its entirety, without modification, and freely distributed in written or electronic form without requesting formal permission. Permission is required for any other use. Requests for permission should be directed to the Software Engineering Institute at DM

3 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Periodic Embedded Real-Time Software Avionics Mission System * Rate Monotonic Scheduling (RMS) * Locke, Vogel, Lucas, and Goodenough. “Generic Avionics Software Specification”. SEI/CMU Technical Report CMU/SEI-90-TR-8-ESD-TR , December, 1990 TaskPeriod weapon release10ms radar tracking40ms target tracking40ms aircraft flight data50ms display50ms steering80ms Domains: Avionics, Automotive OS: OSEK, VxWorks, RTEMS We call them periodic programs

4 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Context: Time-Bounded Verification [FMCAD’11, VMCAI’13] Periodic Program Collection of periodic tasks Execute concurrently with preemptive priority-based scheduling Priorities respect RMS Communicate through shared memory Time-Bounded Verification Assertion A violated within X ms of a system’s execution from initial state I? A, X, I are user specified Time bounds map naturally to program’s functionality (e.g., air bags) Locks CPU-locks, priority ceiling protocol locks [FMCAD’11, VMCAI’13] priority inheritance protocol locks Main focus of this paper

5 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Periodic Program (PP) An N-task periodic program PP is a set of tasks {  1, …,  N } A task  is a tuple  I, T, P, C, A , where I is a task identifier = its priority T is a task body (i.e., code) P is a period C is the worst-case execution time A is the release time: the time at which task becomes first enabled Semantics of PP bounded by time X is given by an asynchronous concurrent program: k i = 0; while (k i < J i && Wait( i, k i )) T i (); k i = k i + 1; k i = 0; while (k i < J i && Wait( i, k i )) T i (); k i = k i + 1; parallel execution w/ priorities parallel execution w/ priorities

6 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Priority Inheritance Protocol (PIP) Ensure mutual exclusion when accessing shared resources Works by dynamically raising and lowering thread priorities Lock: oIf lock, is available, grab it. oOtherwise, block; the thread holding the lock “inherits” my priority Unlock: Release lock. Return to normal priority. Provably avoids the priority inversion problem High-priority task is blocked on a lock held by low-priority task However, incorrect usage leads to deadlocks In contrast to priority ceiling locks and CPU locks [FMCAD’11, VMCAI’13]

7 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Our Contributions Time-bounded verification of reachability properties of PP with PIP locks Based on sequentialization [LR08], but supports PIP locks Challenge: # sequentialization rounds needed for completeness cannot be statically determined Insight: whether more rounds needed can be statically determined Solution: Iterative-deepening search with fixed point check Deadlock detection in PPs with PIP locks Builds dynamically the Task-Resource Graph Aborts if a cycle in that graph is detected Implementation and Empirical Evaluation

8 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Example: A Periodic Program 4 2 TaskPrio (I 1 ) WCET (C i ) Period (P i ) Arrival Time (A i ) 2 1 0 Priority Level

9 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Example: One Schedule Priority Level

Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Example: Viewing as a Round-Based Schedule Priority Level

11 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Example: Viewing as a Round-Based Schedule Priority Level

12 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Sequentialization With PIP locks and fixed #Rounds Priority Level ====

13 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Complete Algorithm: Iteratively Increase #Rounds Priority Level Challenge: Different schedules have different number of rounds #Rounds = #Jobs + #Blocks #Blocks depends on the execution and preemption Solution: Start with a small number of rounds (equal to #Jobs) Add more rounds iteratively till counterexample found, or fixed-point reached

14 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Overall Algorithm Aborts if a job blocks but all R rounds already allocated

15 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Supports C programs w/ tasks, priorities, priority ceiling protocol, shared variables Works in two stages: 1.Sequentialization – reduction to sequential program w/ prophecy variables 2.Bounded program analysis: bounded C model checker (CBMC, HAVOC, …) Periodic Program in C SequentializationSAFE UNSAFE + CEX Periods, WCETs, Initial Condition, Time bound Uses non-determinism (prophecy variables) to allow all possible interleavings between jobs and R – |J| job block events CBMC INCROUNDS

16 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

17 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

18 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

19 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

20 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

21 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Deadlock Detection: Encoding TRG Priority Level TRG: Node = task/lock; Edge = blocking/ownership; Cycle = deadlock Transitive closure of TRG maintained and updated dynamically Program aborts if TRG becomes cyclic (i.e., transitive closure has self-loop) Ownership Edge Blocking Edge

22 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University NXTway-GS: a 2 wheeled self-balancing robot Original: nxt (2 tasks) balancer (4ms) – Keeps the robot upright and responds to BT commands obstacle (50ms) – monitors sonar sensor for obstacle and communicates with balancer to back up the robot Ours: aso (3 tasks) balancer as above but no BT obstacle as above bluetooth (100ms) – responds to BT commands and communicates with the balancer Verified consistency of communication between tasks

23 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Experimental Results

24 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Related, Ongoing and Future Work Related Work Sequentialization of Periodic Programs with CPU locks and priority ceiling protocol locks (FMCAD’11, VMCAI’13) Sequentialization of Concurrent Programs (Lal & Reps ‘08, and others) Sequentialization of Periodic Programs (Kidd, Jagannathan, Vitek ’10) Verification of periodic programs using SPIN (Florian, Gamble, & Holzmann ‘12) Verification of Time Properties of (Models of) Real Time Embedded Systems Model Checking Real-Time Java using JPF (Lindstrom, Mehlitz, and Visser ‘05) Ongoing and Future Work Verification without the time bound Memory Consistency based Sequentialization Abstraction / Refinement Modeling physical aspects (i.e., environment) more faithfully More Examples

25 Verifying Periodic Programs with Priority Inheritance Locks Chaki, Gurfinkel, Kong, Strichman © 2013 Carnegie Mellon University Contact Information Presenter Sagar Chaki SSD Telephone: U.S. mail: Software Engineering Institute Customer Relations 4500 Fifth Avenue Pittsburgh, PA USA Web: Customer Relations Telephone: SEI Phone: SEI Fax:

© 2013 Carnegie Mellon University QUESTIONS?