1 Causal-Consistent Reversible Debugging Ivan Lanese Focus research group Computer Science and Engineering Department University of Bologna/INRIA Bologna,

Slides:



Advertisements
Similar presentations
COMMUNICATING SEQUENTIAL PROCESSES C. A. R. Hoare The Queen’s University Belfast, North Ireland.
Advertisements

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
1 Reversibility for Recoverability Ivan Lanese Computer Science Department FOCUS research group University of Bologna/INRIA Bologna, Italy.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
1 The SOCK SAGA Ivan Lanese Computer Science Department University of Bologna Italy Joint work with Gianluigi Zavattaro.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Kernel language semantics Carlos Varela RPI Adapted with permission.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
1 Static vs dynamic SAGAs Ivan Lanese Computer Science Department University of Bologna/INRIA Italy.
1 Joint work with Claudio Antares Mezzina (INRIA), Jean-Bernard Stefani (INRIA) and Alan Schmitt (INRIA) Controlling Reversibility in Rhopi Ivan Lanese.
1 Sharing Objects – Ch. 3 Visibility What is the source of the issue? Volatile Dekker’s algorithm Publication and Escape Thread Confinement Immutability.
Basic Definitions Data Structures: Data Structures: A data structure is a systematic way of organizing and accessing data. Or, It’s the logical relationship.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
1 Joint work with Antonio Bucchiarone (Fondazione Bruno Kessler - IRST, Trento) and Fabrizio Montesi (University of Bologna/INRIA, Bologna) A Framework.
© 2008 IBM Corporation Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008.
Scala Actors -Terrance Dsilva.  Thankfully, Scala offers a reasonable, flexible approach to concurrency  Actors aren’t a concept unique to Scala.
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
1 Reversibility for Concurrent Interacting Systems Ivan Lanese Focus research group Computer Science and Engineering Department University of Bologna/INRIA.
9/10/2015CS2104, Lecture 81 Programming Language Concepts, COSC Lecture 8 (Multiple) Threads Semantics.
1 Joint work with Michael Lienhardt (PPS), Claudio Antares Mezzina (Trento), Jean-Bernard Stefani (INRIA) and Alan Schmitt (INRIA) Reversibility in Concurrency.
© 2002 P. Van Roy and S. Haridi 1 Teaching Programming with the Kernel Language Approach October 7, 2002 Functional and Declarative Programming in Education.
Programming Translators.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Dynamic Choreographies Safe Runtime Updates of Distributed Applications Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Joint.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Computer Concepts 2014 Chapter 12 Computer Programming.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Amending Choreographies Joint work with Fabrizio Montesi and Gianluigi Zavattaro.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Causal-Consistent Reversibility in a Tuple-Based Language Joint work with Elena.
1 5 Nov 2002 Risto Pohjonen, Juha-Pekka Tolvanen MetaCase Consulting AUTOMATED PRODUCTION OF FAMILY MEMBERS: LESSONS LEARNED.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
11/23/2015CS2104, Lecture 41 Programming Language Concepts, COSC Lecture 4 Procedures, last call optimization.
Debugging parallel programs. Breakpoint debugging Probably the most widely familiar method of debugging programs is breakpoint debugging. In this method,
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Decidability Results for Dynamic Installation of Compensation Handlers Joint.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-4 Process Communication Department of Computer Science and Software.
1 Reversible Debugging Ivan Lanese Focus research group Computer Science and Engineering Department University of Bologna/INRIA Bologna, Italy Joint work.
M. Accetta, R. Baron, W. Bolosky, D. Golub, R. Rashid, A. Tevanian, and M. Young MACH: A New Kernel Foundation for UNIX Development Presenter: Wei-Lwun.
1 Joint work with Claudio Antares Mezzina and Jean-Bernard Stefani Controlled Reversibility and Compensations Ivan Lanese Focus research group Computer.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
ICFEM 2002, Shanghai Reasoning about Hardware and Software Memory Models Abhik Roychoudhury School of Computing National University of Singapore.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
Francesco Tiezzi IMT Advanced Studies Lucca Causal-Consistent Reversibility in a Tuple-Based Distributed Language Joint work with Elena Giachino, Ivan.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Adaptive Choreographies Joint work with Mila Dalla Preda, Jacopo Mauro and Maurizio.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Causal-Consistent Reversibility in a Tuple-Based Distributed Language Joint work.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
An Efficient Compilation Framework for Languages Based on a Concurrent Process Calculus Yoshihiro Oyama Kenjiro Taura Akinori Yonezawa Yonezawa Laboratory.
Basic Concepts: computer, program, programming …
Generics, Exceptions and Undo Command
Process concept.
Chapter 3: Process Concept
CS 153: Concepts of Compiler Design November 30 Class Meeting
Specifying Multithreaded Java semantics for Program Verification
Declarative Computation Model Kernel language semantics (Non-)Suspendable statements (VRH ) Carlos Varela RPI October 11, 2007 Adapted with.
VISUAL BASIC.
Unit 1: Introduction Lesson 1: PArts of a java program
open problems Claudio Antares Mezzina
Dr. Mustafa Cem Kasapbaşı
Subject : T0152 – Programming Language Concept
Declarative Computation Model Single assignment store (VRH 2
CS561 Computer Architecture Hye Yeon Kim
SPL – PS1 Introduction to C++.
Presentation transcript:

1 Causal-Consistent Reversible Debugging Ivan Lanese Focus research group Computer Science and Engineering Department University of Bologna/INRIA Bologna, Italy Joint work with Elena Giachino (FOCUS) and Claudio Antares Mezzina (FBK Trento)

Reversibility for debugging l Our claim: Causal-consistent reversibility can help the programmer to debug concurrent applications l Reversibility helpful also in a sequential setting –Some commercial debuggers provide the command “step back” in a sequential setting –For instance, gdb l Can we apply similar techniques in a concurrent setting? l Can we do better?

Debugging and causality l Debugging amounts to find the bug that caused a given misbehavior l Debugging strategy: follow causality links backward from misbehavior to bug l Which primitives do we need? l Mainly, primitives that given a misbehavior go back towards its causes l We define them in the context of μOz

μOz l A kernel language of Oz [P. Van Roy and S. Haridi. Concepts, Techniques and Models of Computer Programming. MIT Press, 2004] l Oz is at the base of the Mozart language l Thread-based concurrency l Asynchronous communication via ports l Shared memory –Variable names are sent, not their content l Variables are always created fresh and never modified l Higher-order language –Procedures can be communicated

Main primitives l One primitive for each possible misbehavior l Wrong value in a variable: rollvariable id goes to the state just before the creation of variable id l Wrong value in a queue element: rollsend id n undoes the last n sends to port id –If n is unspecied, the last send is undone l Thread blocked on a receive: rollreceive id n undoes the last n reads on the port id –If n is unspecied, the last receive is undone l Unexpected thread: rollthread t undoes the creation of thread t

Using causal-consistent primitives l The programmer can follow causality links backward l No need for the programmer to know which thread or instruction originated the misbehavior –The primitives find them l The procedure can be iterated till the bug is found l Only relevant actions are undone –All the primitives in the last slide are causal consistent

Additional commands l A debugger needs two kinds of commands –Commands to control execution –Commands to explore the configuration »Both code and state l Some of the commands are standard, others related to reversibility or causal consistency

Execution control commands: standard l Step forward –The user specifies the target thread l Run –Round robin scheduler l Breakpoints

Execution control commands: non standard l Step backward –Goes back one step –The user specifies the target thread –Not enabled if waiting for dependencies to be undone –E.g, cannot step back the creation of a thread with not empty history –Only in reversible debuggers l Roll t n –Undoes the last n actions of thread t –Causal consistent –Only in causal-consistent reversible debuggers

Configuration exploration commands l List of threads –Only in concurrent debuggers l Display the code of a thread l Display the history of a thread –Only in reversible debuggers l Display the store l Display the history of a queue –Only in reversible debuggers

Testing our approach l According to [Lu et al., ASPLOS 08] most of the concurrency bugs –Involve only 2 threads, and a few variables –Are order violation, atomicity violation or deadlock l The causal-consitent approach allows the programmer to concentrate on the involved threads l We put our debugger at work on three paradigmatic examples, one for each class of common bugs

CaReDeb: a causal-consistent debugger l Only a prototype to test our ideas l Debugs μOz programs l Written in Java l Based on the reversible semantics of μOz Available at l Starts with java –jar deb.jar inputfile

CaReDeb: a causal-consistent debugger

Future work l Improving the prototype –Usability: integration with eclipse –Performance: both in time and in space l Extending the language –Additional constructs –What about applying the approach to a mainstream language? l Assessment –Can we improve the rate of bug discovery thanks to our approach?

Finally

µOz syntax l S ::= [Statements] skip [Empty statement] S 1 S 2 [Sequence] let x = v in S end [Variable declaration] if x then S 1 else S 2 end [Conditional] thread S end [Thread creation] let x=c in S end [Procedure declaration] {x x 1 … x n } [Procedure call] let x=Newport in S end[Port creation] {Send x y} [Send] let x ={Receive y} in S end[Receive] l c ::= proc {x 1 … x n } S end

μOz semantics l Semantics defined by a stack-based abstract machine l The abstract machine exploits a run-time syntax l Each thread is a stack of instructions –The starting program is inserted into a stack –Thread creation creates new stacks l Procedures are stored as closures l Ports are queues of variables l Semantics closed under –Contexts (for both code and state) –Structural congruence

μOz semantics: rules

μOz reversible semantics l We give unique names to threads l We add histories to threads to remember past actions l We add a delimiter to record when scopes end –For let –For procedure body –For if-then-else l Ports have histories too –Should record also sender and receiver of each message –We do not want to change the order of communications

μOz reversible semantics: forward rules

μOz reversible semantics: backward rules