Replay Composition
Interleaved Step Summary
Ordered Owners
An interleaved replay keeps one global order while each event still belongs to one owner. This script summarizes that shape with vectors.
Program
Play the script to choose how many ordered events to include and watch owner totals accumulate.
interleaved_step_summary.R
max_step <-
owners <- c("main", "worker", "main", "worker")
deltas <- c(1, 2, 3, 4)
main_total <- 0
worker_total <- 0
for (i in seq_len(max_step)) {
if (owners[i] == "main") {
main_total <- main_total + deltas[i]
} else {
worker_total <- worker_total + deltas[i]
}
}
label <- paste(main_total, worker_total, sep = ":")
cat(label, "\n", sep = "")
max_step <-
owners <- c("main", "worker", "main", "worker")
deltas <- c(1, 2, 3, 4)
main_total <- 0
worker_total <- 0
for (i in seq_len(max_step)) {
if (owners[i] == "main") {
main_total <- main_total + deltas[i]
} else {
worker_total <- worker_total + deltas[i]
}
}
label <- paste(main_total, worker_total, sep = ":")
cat(label, "\n", sep = "")
max_step <-
owners <- c("main", "worker", "main", "worker")
deltas <- c(1, 2, 3, 4)
main_total <- 0
worker_total <- 0
for (i in seq_len(max_step)) {
if (owners[i] == "main") {
main_total <- main_total + deltas[i]
} else {
worker_total <- worker_total + deltas[i]
}
}
label <- paste(main_total, worker_total, sep = ":")
cat(label, "\n", sep = "")
global order
`max_step` selects a prefix of the global event order.
owner totals
Each ordered event updates the total for its owner.
interleaving
The loop alternates between owners while preserving one replay order.