1 Failure Handling in a modal Language Nels Eric Beckman Research Talk Institute for Software Research October 30, 2006.

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

Two phase commit. Failures in a distributed system Consistency requires agreement among multiple servers –Is transaction X committed? –Have all servers.
Detecting Bugs Using Assertions Ben Scribner. Defining the Problem  Bugs exist  Unexpected errors happen Hardware failures Loss of data Data may exist.
Selection Control Structures Chapter 5: Selection Asserting Java © Rick Mercer.
ML Exceptions.1 Standard ML Exceptions. ML Exceptions.2 Exceptions – The Need  An extensive part of the code is error handling  A function F can return.
Implementing A Simple Storage Case Consider a simple case for distributed storage – I want to back up files from machine A on machine B Avoids many tricky.
Patterns in ML functions. Formal vs. actual parameters Here's a function definition (in C): –int add (int x, int y) { return x + y; } –x and y are the.
SE-1020 Dr. Mark L. Hornick 1 Exceptions and Exception Handling.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault in the Future Joint work with Gianluigi Zavattaro and Einar Broch Johnsen.
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture XVIII: Concluding Remarks.
COS 461 Fall 1997 Where We Are u so far: networking u rest of semester: distributed computing –how to use networks to do interesting things –connection.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
CSE341: Programming Languages Lecture 6 Tail Recursion, Accumulators, Exceptions Dan Grossman Fall 2011.
Six compound procedures and higher-order procedures.
1 CS 312 – Lecture 28 Continuations –Probably the most confusing thing you’ve seen all semester… Course summary –Life after CS 312.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Java Exceptions. Intro to Exceptions  What are exceptions? –Events that occur during the execution of a program that interrupt the normal flow of control.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
1 A Programming model for failure- prone, Collaborative robots Nels Eric Beckman Jonathan Aldrich School of Computer Science Carnegie Mellon University.
RPC Project Using either sockets or TLI, implement Remote Procedure Calls between two distinct machines that are communicating over an Ethernet network.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Fault in the Future Joint work with Gianluigi Zavattaro and Einar Broch Johnsen.
Introduction to Computer Programming Error Handling.
Language Evaluation Criteria
Java. Why Java? It’s the current “hot” language It’s almost entirely object-oriented It has a vast library of predefined objects It’s platform independent.
Java for enterprise networks Version 2.3 Feb 2008 JSP Validation and Exception handling Why validate? Client side validation.
COMPUTER PROGRAMMING 2 Exceptions. What are Exceptions? Unexpected events that happen when the code is executing (during runtime). Exceptions are types.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Errors And How to Handle Them. GIGO There is a saying in computer science: “Garbage in, garbage out.” Is this true, or is it just an excuse for bad programming?
Patterns in OCaml functions. Formal vs. actual parameters Here's a function definition (in C): –int add (int x, int y) { return x + y; } –x and y are.
Fundamentals of Software Development 1Slide 1 Exceptions What are they?What are they? Why are they useful?Why are they useful? What else can happen at.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
1 Software Construction and Evolution - CSSE 375 Exception Handling - Principles Steve Chenoweth, RHIT Above – Exception handling on the ENIAC. From
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
CPS120: Introduction to Computer Science Decision Making in Programs.
COP-3330: Object Oriented Programming Flow Control May 16, 2012 Eng. Hector M Lugo-Cordero, MS.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Exceptions Chapter 16 This chapter explains: What as exception is Why they are useful Java exception facilities.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
1 CSC 221: Computer Programming I Fall 2005 simple conditionals and expressions  if statements, if-else  increment/decrement, arithmetic assignments.
(c) University of Washington10-1 CSC 143 Java Errors and Exceptions Reading: Ch. 15.
Prof. Necula CS 164 Lecture 171 Operational Semantics of Cool ICOM 4029 Lecture 10.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Today’s Agenda ML Development Workflow –Emacs –Using use –The REPL More ML –Shadowing Variables –Debugging Tips –Boolean Operations –Comparison Operations.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Chapter 9: Continuing Classes By Matt Hirsch. Table Of Contents 1.Static Fields and Methods 2.Inheritance I. Recycle Code with Inheritance II. Overriding.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED ADVANCE FEATURES.
CHAPTER 18 C – C++ Section 1: Exceptions. Error Handling with Exceptions Forces you to defend yourself Separates error handling code from the source.
Information and Computer Sciences University of Hawaii, Manoa
Java Exceptions a quick review….
Lessons from The File Copy Assignment
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Spring 2017.
Why exception handling in C++?
CPS 512 midterm exam #1, 10/7/2016 Your name please: ___________________ NetID:___________ /60 /40 /10.
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Spring 2013.
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Autumn 2018.
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Zach Tatlock Winter 2018.
Announcements Quiz 5 HW6 due October 23
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Spring 2016.
Tenth step for Learning C++ Programming
CSC 143 Java Errors and Exceptions.
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Spring 2019.
CSE341: Programming Languages Section 1
Exceptions and Exception Handling
CSE341: Programming Languages Lecture 6 Nested Patterns Exceptions Tail Recursion Dan Grossman Autumn 2017.
Presentation transcript:

1 Failure Handling in a modal Language Nels Eric Beckman Research Talk Institute for Software Research October 30, 2006

Failure Handling in a Modal Language ISR 2 Claims Made in this Talk ML5 is an elegant language for programming distributed systems. In the face of node failure, the meaning of ML5 programs becomes unclear. We propose extensions to ML5 that makes their meaning clear. (In reality, this research is a work in progress.)

Failure Handling in a Modal Language ISR 3 ML5 A Programming Language for Distributed Systems Based on a Modal Logic i.e. A Logic With an Embedded Notion of Place Tom Murphy’s Thesis Work Targeted for Grid Programming

Failure Handling in a Modal Language ISR 4 ML5, Briefly... Allows Hosts to Send ‘Thunks’ to One Another for Execution In practice, code can be more cleanly decomposed. Has An Advanced Type System Location-specific resources can be typed as so.

Failure Handling in a Modal Language ISR 5 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 6 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 7 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 8 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x; rpc “b”

Failure Handling in a Modal Language ISR 9 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 10 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 11 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x;

Failure Handling in a Modal Language ISR 12 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x; ret x

Failure Handling in a Modal Language ISR 13 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x; ret x

Failure Handling in a Modal Language ISR 14 RPC-Style Distributed Programming PC Host Active thread Blocked thread Message fun a = fun b = rpc(“b”,19. x.x.x) + r return x; ret x

Failure Handling in a Modal Language ISR 15 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 16 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 17 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 18 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 19 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 20 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 21 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 22 ML5 Illustration PC Host Location of thread Migration of thread

Failure Handling in a Modal Language ISR 23 Example Remotely Finding List’s Sum (RPC) Server Code: class ListServ { List myList = new... List getList() { return myList; } }

Failure Handling in a Modal Language ISR 24 Example Remotely Finding List’s Sum (RPC) Client Code: class ListClient { ListServerStub myServ = new... public void foo() { List list = myServ.getList(); for(Integer item: list) { count+= item.intValue(); } if( count >= 40 )... }}

Failure Handling in a Modal Language ISR 25 Example Remotely Finding List’s Sum (RPC) To Fix Should We: Add a new server operation that returns true if a list’s sum is greater than 40? Weird if operation is only used once. We wouldn’t structure application this way in a centralized setting. Bite the performance bullet and send the whole list?

Failure Handling in a Modal Language ISR 26 Example Remotely Finding List’s Sum (ML5) Before: fun foo remote_host remote_list_ref = let fun sum a_list = foldl op+ 0 a_list in if sum ( get[remote_host]( !remote_list_ref ) ) > 40 then true else false

Failure Handling in a Modal Language ISR 27 Example Remotely Finding List’s Sum (ML5) After: fun foo remote_host remote_list_ref = let fun sum a_list = foldl op+ 0 a_list in get[remote_host]( if sum ( !remote_list_ref ) > 40 then true else false )

Failure Handling in a Modal Language ISR 28 Types ML5 Type System Embeds a Notion of Place Some values can be used at any place. e.g. Primitive data types, structures Some values can only be used at the location where they make sense. e.g. File descriptors, reference cells, printers

Failure Handling in a Modal Language ISR 29 Just a Few Types… – “The type τ is well-typed on host w.”

Failure Handling in a Modal Language ISR 30 Just a Few Types… get[w’,a]e – “Evaluate e on host w’ and return the result to the current host. Change e’s type Example: fun foo (x: int a: w’ = get[w’,a]( !x + !x )

Failure Handling in a Modal Language ISR 31 Just a Few Types… get[w’,a]e – “Evaluate e on host w’ and return the result to the current host. Change e’s type Example: fun foo (x: int a: w’ = get[w’,a]( !x + !x ) Typed

Failure Handling in a Modal Language ISR 32 get[w’,a]e – “Evaluate e on host w’ and return the result to the current host. Change e’s type Example: fun foo (x: int a: w’ = get[w’,a]( !x + !x ) Just a Few Types… Typed

Failure Handling in a Modal Language ISR 33 Just a Few Types… □ τ – “Suspended code that can be evaluated anywhere. Produces a value of type τ.” Example: (let fun sum il = foldl op+ 0 il in box (sum [1,2,3,4,5]) end):

Failure Handling in a Modal Language ISR 34 Just a Few Types… ◊ τ – “A value of type τ that exists at some other location.” Example: here (ref 5):◊(ref

Failure Handling in a Modal Language ISR 35 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3))

Failure Handling in a Modal Language ISR 36 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3)) Host 2 dies!

Failure Handling in a Modal Language ISR 37 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3)) Host 2 dies! Throw an exception?

Failure Handling in a Modal Language ISR 38 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3)) Host 2 dies! Throw an exception? Continue on from Host 3?

Failure Handling in a Modal Language ISR 39 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3) or_if_i_cant_return (...))) Host 2 dies! Throw an exception? Continue on from Host 3?

Failure Handling in a Modal Language ISR 40 But What About Host Failure? What happens here? (* at host 1 *) get[w_2, a_2]( (* at host 2 WHICH DOESN’T EXIST!*) !int_ref_at_w_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_w_3) or_if_i_cant_return (...))) Host 2 dies! Throw an exception? Continue on from Host 3?

Failure Handling in a Modal Language ISR 41 What We Want (Intuitively) callcc x => (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_h_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_h_3 or_if_i_cant_return (throw (raise NetFail) to x)))

Failure Handling in a Modal Language ISR 42 What We Want (Intuitively) callcc x => (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_h_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_h_3 or_if_i_cant_return (throw (raise NetFail) to x))) Don’t actually throw something through the network.

Failure Handling in a Modal Language ISR 43 What We Want (Intuitively) callcc x => (* at host 1 *) get[w_2, a_2]( (* at host 2 *) !int_ref_at_h_2 + get[w_3, a_3]( (* at host 3 *) !int_ref_at_h_3 or_if_i_cant_return (throw (raise NetFail) to x))) Don’t actually throw something through the network. Have host one detect the failure.

Failure Handling in a Modal Language ISR 44 Isn’t This Just a ‘Timeout’ Exception? A Good Question: “Why not just have the ‘get’ operation throw a timeout exception, like in Java?” e.g. get[w_2, a_2] ( !int_on_w2 ) handle TimeOut => (* do something *)

Failure Handling in a Modal Language ISR 45 Answers 1.This is actually a little smarter than just ‘timeout.’ 2.The ‘Implicit Spawn’ Problem

Failure Handling in a Modal Language ISR 46 Answers 1.This is actually a little smarter than just ‘timeout.’ 2.The ‘Implicit Spawn’ Problem get[w_2, a_2] ( (* extremely complicated op *) ) handle TimeOut => (* do something *)

Failure Handling in a Modal Language ISR 47 Answers 1.This is actually a little smarter than just ‘timeout.’ 2.The ‘Implicit Spawn’ Problem get[w_2, a_2] ( (* extremely complicated op *) ) handle TimeOut => (* do something *) T2 T1

Failure Handling in a Modal Language ISR 48 What We Need Share the Fact that Host 1 Has ‘Given Up’ Kill the Thread ASAP Make That Thread’s Actions Irrelevant Each host gets a chance to ‘undo’ potential effects. All with ‘Best Effort’

Failure Handling in a Modal Language ISR 49 One More Wrinkle Catom 1 Catom 2 Grab ‘continuation’

Failure Handling in a Modal Language ISR 50 One More Wrinkle Catom 1 Catom 2 Assign ‘Catom1’ to ‘myLeader’

Failure Handling in a Modal Language ISR 51 One More Wrinkle Catom 1 Catom 2

Failure Handling in a Modal Language ISR 52 The Design, In Short try e_1 continuing e_2 end

Failure Handling in a Modal Language ISR 53 The Design, In Short try e_1 continuing e_2 end 1.Execute e_1

Failure Handling in a Modal Language ISR 54 The Design, In Short try e_1 continuing e_2 end 1.Execute e_1 2.In the event of node failure... the entire expression will throw an exception on this host.

Failure Handling in a Modal Language ISR 55 The Design, In Short try e_1 continuing e_2 end 1.Execute e_1 2.In the event of node failure... the entire expression will throw an exception on this host. 3.On the other hosts, e_2 will be executed, and its value discarded.

Failure Handling in a Modal Language ISR 56 The Design, In Short (* host 1*) try (* set all of my neighbor’s ‘myLeader’ to host 1 *) continuing if !myLeader = host_1 then myLeader := NONE else () end

Failure Handling in a Modal Language ISR 57 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end

Failure Handling in a Modal Language ISR 58 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end Store Cont(stack)

Failure Handling in a Modal Language ISR 59 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end Store Cont(▪;l)

Failure Handling in a Modal Language ISR 60 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end

Failure Handling in a Modal Language ISR 61 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end Store Cont(▪;l)

Failure Handling in a Modal Language ISR 62 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end

Failure Handling in a Modal Language ISR 63 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end

Failure Handling in a Modal Language ISR 64 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end Error!

Failure Handling in a Modal Language ISR 65 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC try continuing l: end Restore Cont. PC l:

Failure Handling in a Modal Language ISR 66 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC raise Fail) handle... PC l:

Failure Handling in a Modal Language ISR 67 ML5-C: Error Continuations Host Visited Host Location of thread Migration of thread PC raise Fail) handle...

Failure Handling in a Modal Language ISR 68 Interesting Note In Failure Case, We Have to Reason About Client and Server. (The avoidance of this was one of the touted benefits of ML5!)

Failure Handling in a Modal Language ISR 69 Future Work This Work is Not Yet Finished More Restrictive Modal Basis Only neighbor catoms are accessible This would be a ‘lower level’ language in some sense.

70 Thanks! Additional Questions?

Failure Handling in a Modal Language ISR 71 Failure Handling is More Natural In Claytronics, Failure is Possible at Any Moment. Intuitively, it would be nice to say: try { // a complex, multi host operation } catch (Failure v) { // take an alternate // course of action. }

72 So You Want to See the Typing Rules... Note: These rules represent just a snapshot of the work.