Title: Backtracking for Distributed Model Execution
1Backtracking forDistributed Model Execution
- Motivation
- Distributed model execution requires
backtracking. When a component receives a message
tagged with a time in its past, it must rollback
and process the message in the correct sequential
order. - Incremental backtracking aims to capture every
change in model states. Every time an actor
assigns a new value to its private non-static
field (state), the old value must be remembered
so that a rollback can be issued later. - Automatic Java Source Refactoring
- It is boring for the programmers to manually
capture all the changes, so we take a refactoring
approach. - An Eclipse plug-in refactors actor source code
as it is being written. A command-line tool is
implemented to refactor a list of sources at a
time. - Backtracking with Checkpoint Objects
- A checkpoint object monitors a group of objects
to be checkpointed and rolled back at the same
time. - A timestamp is the handle of a checkpoint.
- The rollback method of a checkpoint object rolls
the state back to a previous timestamp. - Modified SDF Director
- In its original design, SDF does not conform to
the prefire-fire-postfire semantics. - The modified SDF director conforms to the
prefire-fire-postfire semantics by recording a
checkpoint before the first fire. - SDF composite actors can now be embedded in CT
and provide the correct semantics in a clean way.
package mypackage import java.io.InputStream /
A buffer of predefined size for an input
stream. / public class StreamBuffer /
Construct a buffer with an input stream.
/ public StreamBuffer(InputStream
stream) _stream stream
/ Return the next byte in the buffer.
If the buffer is empty, more bytes are
read from the input stream. / public
byte nextByte() throws Exception if
(_pointer gt SIZE)
_stream.read(_buffer) _pointer 0
return _buffer_pointer
/ Size of the buffer.
/ public static final int SIZE 20
// The buffer. private byte _buffer new
byteSIZE // The current read position
in the buffer. private int _pointer SIZE
// The input stream to be read.
private InputStream _stream
package refactored.mypackage import
java.io.InputStream import java.lang.Object impo
rt ptolemy.backtrack.Checkpoint import
ptolemy.backtrack.Rollbackable import
ptolemy.backtrack.util.CheckpointRecord import
ptolemy.backtrack.util.FieldRecord / A
buffer of predefined size for an input stream.
/ public class StreamBuffer implements
Rollbackable protected Checkpoint
CHECKPOINT new Checkpoint(this) /
Size of the buffer. / public
static final int SIZE 20 // The buffer.
private byte _buffer new byteSIZE
// The current read position in the buffer.
private int _pointer SIZE // The input
stream to be read. private InputStream
_stream / Construct a buffer
with an input stream. / public
StreamBuffer(InputStream stream)
ASSIGN_stream(stream) /
Return the next byte in the buffer. If the
buffer is empty, more bytes are read from
the input stream. / public byte
nextByte() throws Exception if
(_pointer gt SIZE)
_stream.read(BACKUP_buffer())
ASSIGN_pointer(0) return
_bufferASSIGNSPECIAL_pointer(11, _pointer)
// Extra fields and methods omitted.
...