1 Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault Model Design Space for Cooperative Concurrency Joint work with Michael.

Slides:



Advertisements
Similar presentations
Chapter 17 Failures and exceptions. This chapter discusses n Failure. n The meaning of system failure. n Causes of failure. n Handling failure. n Exception.
Advertisements

1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.
COMMUNICATING SEQUENTIAL PROCESSES C. A. R. Hoare The Queen’s University Belfast, North Ireland.
25 February 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department.
Pontus Boström and Marina Waldén Åbo Akademi University/ TUCS Development of Fault Tolerant Grid Applications Using Distributed B.
Exception Handling Chapter 15 2 What You Will Learn Use try, throw, catch to watch for indicate exceptions handle How to process exceptions and failures.
An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
Exceptions and Exception Handling Carl Alphonce CSE116 March 9, 2007.
Exceptions and Exception Handling Carl Alphonce CSE116.
Jerry Lebowitz. Topics  Provides a facility for a systematic object oriented approach to handling runtime errors ◦ Can also handle runtime errors.
1 Lecture 11 Interfaces and Exception Handling from Chapters 9 and 10.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault in the Future Joint work with Gianluigi Zavattaro and Einar Broch Johnsen.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
1 Ivan Lanese Computer Science Department University of Bologna Italy On the Interplay between Fault Handling and Request-response Service Invocations.
1 The SOCK SAGA Ivan Lanese Computer Science Department University of Bologna Italy Joint work with Gianluigi Zavattaro.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy On the Expressive Power of Primitives for Compensation Handling Joint work with.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 11 Exception Handling and Event Handling.
1 SOCK and JOLIE from the formal basis to a service oriented programming language Ivan Lanese Computer Science Department University of Bologna Italy Joint.
Concurrency CS 510: Programming Languages David Walker.
1 Ivan Lanese Computer Science Department University of Bologna Italy Behavioural Theory for SSCC Joint work with Luis Cruz-Filipe, Francisco Martins,
1 Ivan Lanese Computer Science Department University of Bologna Italy Evolvable systems: some ideas for modelling With input from Davide Sangiorgi, Fabrizio.
Bridging the gap between Interaction- and Process-Oriented Choreographies Talk by Ivan Lanese Joint work with Claudio Guidi, Fabrizio Montesi and Gianluigi.
Bridging the gap between Interaction- and Process-Oriented Choreographies Talk by Ivan Lanese Joint work with Claudio Guidi, Fabrizio.
1 Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Error Handling: From Theory to Practice Joint work with Fabrizio Montesi italianaSoftware.
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 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
29-Jun-15 Java Concurrency. Definitions Parallel processes—two or more Threads are running simultaneously, on different cores (processors), in the same.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault in the Future Joint work with Gianluigi Zavattaro and Einar Broch Johnsen.
1 Ivan Lanese Computer Science Department University of Bologna Italy On the expressive power of primitives for compensation handling Joint work with Catia.
1 Ivan Lanese Computer Science Department University of Bologna Italy Streaming Services in SSCC Joint work with Francisco Martins, Vasco Vasconcelos and.
1 Exception Handling Introduction to Exception Handling Exception Handling in PLs –Ada –C++ –Java Sebesta Chapter 14.
Object Oriented Programming
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
1 Joint work with Michael Lienhardt (PPS), Claudio Antares Mezzina (Trento), Jean-Bernard Stefani (INRIA) and Alan Schmitt (INRIA) Reversibility in Concurrency.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Dynamic Choreographies Safe Runtime Updates of Distributed Applications Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Joint.
Towards Global and Local Types for Adaptation Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Joint work with Mario Bravetti,
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Amending Choreographies Joint work with Fabrizio Montesi and Gianluigi Zavattaro.
1 Causal-Consistent Reversible Debugging Ivan Lanese Focus research group Computer Science and Engineering Department University of Bologna/INRIA Bologna,
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Causal-Consistent Reversibility in a Tuple-Based Language Joint work with Elena.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
ABSTRACT The real world is concurrent. Several things may happen at the same time. Computer systems must increasingly contend with concurrent applications.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
“Dynamic fault handling mechanisms for service-oriented applications” Fabrizio Montesi, Claudio Guidi, Ivan Lanese and Gianluigi Zavattaro Department of.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Decidability Results for Dynamic Installation of Compensation Handlers Joint.
SPL/2010 Guarded Methods and Waiting 1. SPL/2010 Reminder! ● Concurrency problem: asynchronous modifications to object states lead to failure of thread.
1 Joint work with Claudio Antares Mezzina and Jean-Bernard Stefani Controlled Reversibility and Compensations Ivan Lanese Focus research group Computer.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Exception Handling in C++. Outline What exceptions are and when to use them Using try, catch and throw to detect, handle and indicate exceptions, respectively.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
Exceptions Lecture 11 COMP 401, Fall /25/2014.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
SENG521 (Fall SENG 521 Software Reliability & Testing Fault Tolerant Software Systems: Techniques (Part 4a) Department of Electrical.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Adaptive Choreographies Joint work with Mila Dalla Preda, Jacopo Mauro and Maurizio.
Fundamentals of Fault-Tolerant Distributed Computing In Asynchronous Environments Paper by Felix C. Gartner Graeme Coakley COEN 317 November 23, 2003.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Causal-Consistent Reversibility in a Tuple-Based Distributed Language Joint work.
Adding Concurrency to a Programming Language Peter A. Buhr and Glen Ditchfield USENIX C++ Technical Conference, Portland, Oregon, U. S. A., August 1992.
Exception Handling in C++
Exception Handling and Event Handling
Internet of Things A Process Calculus Approach
Java Concurrency 17-Jan-19.
Java Concurrency.
Java Concurrency.
Java Concurrency 29-May-19.
CMSC 202 Exceptions.
Presentation transcript:

1 Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault Model Design Space for Cooperative Concurrency Joint work with Michael Lienhardt, Mario Bravetti, Einar Broch Johnsen, Rudolf Schlatte, Volker Stolz and Gianluigi Zavattaro

From one ISoLA to another l At ISoLA 2010 Which properties a good fault model should satisfy l At ISoLA 2014 The design space of fault models for the ABS language l Some of the properties discussed in 2010 will turn out to be relevant

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

Our aim l A fault model is a main component of a language design l Refined fault models have been developed for mainstream languages –Such as Java, C++ or Haskell l Can we say something more? l Yes, since the fault model is related to the other constructs of the language! l ABS uses cooperative concurrency, while Java, C++ and Haskell do not

ABS language l A concurrent object-oriented language l Chosen as specification language inside the HATS and ENVISAGE European projects l Based on asynchronous method calls and futures l Providing cooperative concurrency l Equipped with a full formal semantics based on rewriting logic l Suitable for static analysis

Futures l A standard mechanism for allowing asynchronous method calls (cfr. java.util.concurrent) l An asynchronous method call spawns a remote computation but the local computation can proceed l The result of the remote computation is stored in a future l The caller checks the future to get the result –It blocks only when it needs the result l In ABS, futures are first-class entities

ABS basics l s ::= …(standard o-o constructs) f := o!m(p 1,…p n )(asynchronous invocation) x := f.get(read future) await g do {s}(await) suspend(processor release) l g is a guard including: –Checks for future availability: ?f –Boolean expressions

Cooperative concurrency and invariants l ABS suitable for reasoning based on invariants on the state of objects l Invariants should hold at all points where the processor may be released –suspend and await l No interference is possible at other program points l Verification of concurrent programs using sequential reasoning

Aspects of faults l We will consider 3 aspects of faults l What a fault is? –How is it represented inside the language? l What a fault does? –How is it generated? –How is it managed? –What happens if it is not? l Where a fault goes? –How does a fault propagate? –Who is notified about it?

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

What a fault is? l Exceptions are the language concept corresponding to faults l ABS features two concepts that may be suitable to represent exceptions –Objects: have both a mutable state and a behavior –Datatypes: represent simple structures such as lists and sets l Exceptions need only to be generated and consumed l This pushes towards datatypes –To preserve simplicity of language use and analisys

Is exception a datatype? l Programmers need two kinds of exceptions: –system-defined: Division by Zero, Array out of Bounds –user-defined:... l Programmers of modules need to define local exceptions l There is the need for an open datatype –not available in ABS

Introducing open datatypes l Introducing open datatypes in ABS –major change of a main feature of ABS –in contrast with the fact that ABS has a nominal type system l Allowing any datatype to be an exception –new exceptions can be added by defining new datatypes –to understand an exception, a case on the type and on the constructor needs to be performed –information on types should be kept at run-time l Exceptions are the unique extensible datatype –the solution with minimal impact on ABS

Exception as unique extensible datatype l Declaration: exception NullPointerException exception RemoteAccessException exception MyUserDefinedException(Int, String) l Use: try {... } catch (e) { NullPointerException =>... MyUserDefinedException(n,s) =>... e2 =>... }

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

What an exception does? l Exceptions are managed using try... catch... l Exceptions may be generated –By the throw e command –By normal commands, such as x:=y/0; –By errors in a remote communication »Asynchronous method invocation l Where are exceptions due to asynchonous communication raised? –Not by the asynchronous method invocation –By the get on the corresponding future –Possibly by the await

What an unmanaged exception does? l An unmanaged exception kills the current process, releasing the lock l To enable proofs by invariants, the invariant should hold whenever an exception may be raised –Not easy –Rollback may be an option l If the invariant cannot be guarenteed, the whole object needs to be killed l If invariants would involve more than one object, all of them would need to be killed

Exception properties l Not all exceptions need to kill the object if unmanaged l Only the ones for which it is not possible to guarentee the invariant l Can be specified by a property deadly l Exceptions may also have other kinds of properties –E.g., catchable or not

Where are exception properties declared? l In the exception declaration: deadly exception ArrayOutOfBound –The exception will behave the same in all contexts l In the construct raising it: throw deadly ArrayOutOfBound –Also, x:=a[i] deadly –Behavior of exception not visible in the declarations l In the method: Int calc(Int x) deadly ArrayOutOfBound –Enough to look at method declaration –More compositional –Not suitable for properties relevant inside the method (e.g., catchable)

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

Where an exception goes? l Information about raised exceptions should be propagated –Other methods/objects may be influenced by the exception –In particular, for uncaught exceptions l Possible targets are: –Methods using the result of the computation –Methods invoked by the failed one –Other methods in the same object –Methods trying to access the object after it died

Propagation through futures l In synchronous method calls, only the caller has direct access to the result of a computation l With asynchronous method calls, all the methods receiving the future have access to the result –the caller may be one of them or not –may even terminate before l The future is accessed via await and get –The get should raise the exception »There is no value in the future –Less clear for the await

Propagation through futures: concurrency l Different processes can perform a get on the same future concurrently l All of them should raise an exception –Avoids races –Ensures the behaviour of the future changes at most once

Propagation through method invocations l When a method raises an exception, many invocations from it to other methods may be running or pending –because of asynchronicity l Those invocations may become useless or even undesired because of the exception l A mechanism to cancel them seems useful l There are different possible timings: –if they have not started yet, the invocation can be removed –if they are running, an exception may be raised in them –if they have completed, they may be compensated

How to cancel method invocations? l Programmed propagation –An explicit primitive f1 := f.cancel(e) is used »f is the future individuating the invocation »e is the exception to be thrown »f1 will contain the result of the cancellation –Suitable for caught exceptions l Automatic propagation –The exception is sent to all the methods invoked whose future has not been checked yet –One may also want to consider futures received/passed as parameters –Suitable for uncaught exceptions

Propagation to processes in the same object l If the invariant cannot be restored, killing the object may be too extreme l The exception may be propagated to the next method invocations to be executed –they may be able to manage it l Exception may be raised –at the beginning of a method invocation –when it resumes after an await or suspend l A dedicated system exception should be used

Propagation through dead objects l If an object is dead, the invocation of one of its methods should raise an exception l Surely in case of get, not clear for await l A dedicated system exception should be raised

Roadmap l Cooperative concurrency l What a fault is? l What a fault does? l Where a fault goes? l Conclusion

Conclusion l Designing a fault model for ABS involves many, non trivial choices –the best interplay between exceptions and await is not yet clear l Asynchronous method calls, futures, cooperative concurrency and invariants have an impact on the choices –the choices good for Java may not be good for ABS

What about ISoLA 2010 properties? l For theoretical models –Full specification: quite tricky to ensure without a formal semantics –Expressiveness, minimality: the main trade-off we considered –Intuitiveness: we tried to address it l For programming languages –Usability: more validation needed –Robustness: we provided constructs to deal with network failures –Compatibility: not addressed l Most properties are relevant, mainly the ones for theoretical models

Future/related work l Some of the alternatives we propose have never been fully explored l A full exploration will require –the precise definition of their semantics –their introduction in the ABS implementation l A few (complex) alternatives have been partially explored –Compensations [COORDINATION 2011] –Rollback [previous talk]

End of talk