More complicated model with multiple server/client pairs - wip

This commit is contained in:
Nicholas Kariniemi 2015-08-15 14:58:59 +03:00
parent 30bbfff308
commit 14a8c340e0

View file

@ -1,19 +1,27 @@
N = 3 N = 2
channel input, render, up, down, save:{0..N-1} S = 3
STATES = {0..S-1}
CONN_NAMES = {0..N-1}
channel input, render, up, down:STATES
channel save:CONN_NAMES.STATES
apply(state, patch) = (state + patch) % N apply(state, patch) = (state + patch) % S
diff(state1, state2) = (state2 - state1) % N diff(state1, state2) = (state2 - state1) % S
CLIENT(state, shadow) = CLIENT(i, state, shadow) =
input?new_state -> up!diff(shadow, new_state) -> CLIENT(new_state, shadow) input?new_state -> up!diff(shadow, new_state) -> CLIENT(i, new_state, shadow)
[] down?patch -> if patch != 0 [] down?patch -> if patch != 0
then render!apply(state, patch) -> CLIENT(apply(state, patch), apply(shadow, patch)) then render!apply(state, patch) -> CLIENT(i, apply(state, patch), apply(shadow, patch))
else CLIENT(state, state) else CLIENT(i, state, state)
SERVER(state, shadow) = SERVER(i, state, shadow) =
up?patch -> save!apply(state, patch) -> down!diff(apply(shadow, patch), apply(state, patch)) up?patch -> save!i!apply(state, patch)
-> SERVER(apply(state, patch), apply(shadow, patch)) -> down!diff(apply(shadow, patch), apply(state, patch))
-> SERVER(i, apply(state, patch), apply(shadow, patch))
[] save?save_i?new_state -> if (new_state == state) then SERVER(i, state, shadow) else
down!diff(apply(shadow, patch), apply(state, patch))
-> SERVER(i, apply(state, patch), apply(shadow, patch)
SYSTEM = CLIENT(0, 0) ||| SERVER(0, 0) SYSTEM = CLIENT(0, 0, 0) ||| CLIENT(1, 0, 0) ||| SERVER(0, 0, 0) ||| SERVER(1, 0, 0)
assert SYSTEM :[deadlock free [F]] assert SYSTEM :[deadlock free [F]]