Rollback by Reverse Computation Kevin Hamlen CS717: Fault-Tolerant Computing.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Parallel Processing & Parallel Algorithm May 8, 2003 B4 Yuuki Horita.
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
SUPPLEMENTARY CHAPTER 2 Instruction Addressing Modes
Parallel and Distributed Simulation Time Warp: Basic Algorithm.
Parallel and Distributed Simulation Time Warp: Other Mechanisms.
CS 355 – Programming Languages
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 18.
Parallel and Distributed Simulation Time Warp: State Saving.
1 Tuesday, November 07, 2006 “If anything can go wrong, it will.” -Murphy’s Law.
Recap from last time We were trying to do Common Subexpression Elimination Compute expressions that are available at each program point.
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
CS533 Concepts of Operating Systems Class 6 The Duality of Threads and Events.
Control Structures. Hierarchical Statement Structure Standard in imperative languages since Algol60. Exceptions: Early FORTRAN, COBOL, early BASIC, APL.
Run time vs. Compile time
Chapter 9: Subprogram Control
Improving Code Generation Honors Compilers April 16 th 2002.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Inline Function. 2 Expanded in a line when it is invoked Ie compiler replace the function call with function code To make a function inline the function.
FunctionsFunctions Systems Programming Concepts. Functions   Simple Function Example   Function Prototype and Declaration   Math Library Functions.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Language Evaluation Criteria
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Runtime Environments What is in the memory? Runtime Environment2 Outline Memory organization during program execution Static runtime environments.
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
Runtime Environments Compiler Construction Chapter 7.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
JAVA 0. HAFTA Algorithms FOURTH EDITION Robert Sedgewick and Kevin Wayne Princeton University.
Languages and the Machine Chapter 5 CS221. Topics The Compilation Process The Assembly Process Linking and Loading Macros We will skip –Case Study: Extensions.
Time Warp State Saving and Simultaneous Events. Outline State Saving Techniques –Copy State Saving –Infrequent State Saving –Incremental State Saving.
 2007 Pearson Education, Inc. All rights reserved C Functions -Continue…-
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Memory Management Issues, Solutions, and Examples.
Programmatic SQL Shaista Khan CS 157B. Topic Embedded SQL statements in high-level programming languages.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Implementing Subprograms What actions must take place when subprograms are called and when they terminate? –calling a subprogram has several associated.
RUN-Time Organization Compiler phase— Before writing a code generator, we must decide how to marshal the resources of the target machine (instructions,
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-2.ppt Modification date: March 23, Procedures Essential ingredient of high level.
Introduction to OpenMP Eric Aubanel Advanced Computational Research Laboratory Faculty of Computer Science, UNB Fredericton, New Brunswick.
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CSC 8505 Compiler Construction Runtime Environments.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
RUNTIME ENVIRONMENT AND VARIABLE BINDINGS How to manage local variables.
LECTURE 18 Control Flow. CONTROL FLOW Sequencing: the execution of statements and evaluation of expressions is usually in the order in which they appear.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
1 Assembly Language: Function Calls Jennifer Rexford.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
C Program Control September 15, OBJECTIVES The essentials of counter-controlled repetition. To use the for and do...while repetition statements.
CS 536 © CS 536 Spring Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 15.
FUNCTIONS In C++.
Revision Lecture
Parallel and Distributed Simulation Techniques
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Imperative languages Most familiar: computation modifies store
Chapter 9 :: Subroutines and Control Abstraction
Parallel and Distributed Simulation
Homework Any Questions?.
Runtime Environments What is in the memory?.
Dynamic Binary Translators and Instrumenters
Presentation transcript:

Rollback by Reverse Computation Kevin Hamlen CS717: Fault-Tolerant Computing

Research on Reversible Computation Quantum Computing –Quantum Computation (Nielsen & Chuang) Nanocomputers –Ralph Zyvex ( Low-power processor design – Computational Complexity Theory –Time and Space Bounds for Reversible Simulation (Buhrman, Tromp, and Vitányi) Parallel Programs & Fault Tolerance –Carothers (RPI), Perumalla (Georgia Tech), and Fujimoto (Georgia Tech)

Georgia Tech Time Warp (GTW) General purpose simulator –telecommunication network simulations –commercial air traffic simulations Parallel –Shared memory –Message passing Event-based –Each computation and each event associated with a stimulus event Executes programs written in C/C++ w/API calls “General purpose parallel discrete event simulation executive”

Optimistic Synchronization Incorrect computations permitted –Roll back when error detected Direct cancellation

State-Saving Copy state-saving – copy of entire state saved before every event Periodic state-saving – copy of entire state saved before every p th event Incremental state-saving – copy of only modified state saved before every event Reversible Computing – copy of only destroyed state data saved before every event

Advantages of Reversible Computing Lower space overhead for saved state Lower time overhead in non-rollback case Cost of state-saving amortized over duration of computation Advantages most pronounced in fine- grained settings (i.e. many events each associated with small computations)

Reversing C Programs Original int x=0, y=1; f() { if (x>y) y += x; else x += y; } Reversible int x=0, y=1; bit b; f’() { b = (x>y); if (b) y += x; else x += y; } Reverse int x=0, y=1; bit b; rf’() { if (b) y -= x; else x -= y; } Note: If S is the state, then we need rf’(f’(S))==S. However we don’t care about the result of f’(rf’(S)).

RCC: Reverse C Compiler Transforms arbitrary C programs Each function made reversible A reverse of each function is generated GTW Executive modified to call function reverses during rollback

Saving Destroyed State Data: The Tape Driver Abstraction SAVE_BYTES(var) – push var onto the tape and increment the tape pointer by sizeof(var)*8 RESTORE_BYTES(var) – pop var from the tape and decrement the tape pointer by sizeof(var)*8 SAVE_BITS(var, n) – push the n low-order bits of var onto the tape; increment the tape pointer by n RESTORE_BITS(var, n) – pop n bits from the tape and store them in the n low-order bits of var; decrement the tape pointer by n

RCC’s Transformation Original int x=0, y=1; f() { if (x>y) y += x; else x += y; } Reversible int x=0, y=1; f’() { char c=!!(x>y); if (c) y += x; else x += y; SAVE_BITS(c,1); } Reverse rf’() { char c; RESTORE_BITS(c,1); if (c) y -= x; else x -= y; }

RCC Compilation Procedure NormalizeTransformOptimize Original C Program Reversible C Program w/reverses

Normalization Post-conditions Only one assignment per expression. No other side-effects in such an expression except possibly a single function call. for() loops replaced by equivalent while()’s. Conditional expressions are side-effect free. Only one return statement per function. It has the form “return;” or “return var;” break’s and continue’s replaced by goto’s.

Two Unusual Normalizations All floating point datatypes promoted to strictly higher precision types –Software emulation of a new highest-precision datatype may be necessary. Abnormal exit (via goto) from a block requires saving all variables which are about to go out of scope. –Analogous to how C++ handles implicit destructor calls

Transformation Phase: Block Scopes Original { int x, y; s1 s2 s3 } Reversible { int x, y; s1 s2 s3 SAVE(x); SAVE(y); } Reverse { int x, y; RESTORE(y); RESTORE(x); rs3 rs2 rs1 }

Interesting Transformations Function pointer calls – maintain a hash table of the reverses of functions Labeled join points – introduce a variable to record the source of the jump Loops – introduce a counter variable to record the number of iterations

Optimization Phase Irreversible operations ignored (e.g. output, network message sends) Kernel-reversible operations are special cases (e.g. message cancellation) Dataflow analysis on reverses (esp. initializer expressions) Invariant detection (esp. conditionals) Tape compression (esp. loops)

References C. Carothers, K. S. Perumalla, R. M. Fujimoto. “Efficient Optimistic Parallel Simulations using Reverse Computation.” In Proceedings of 13 th Workshop on Parallel and Distributed Simulation, May K.S. Perumalla and R. M. Fujimoto. “Source code transformations for efficient reversibility.” Technical Report, GIT-CC-99-21, College of Computing, Georgia Institute of Technology.