800 likes | 907 Vues
Learn about Bounded Retransmission Protocol for reliable data transfer in real-time systems. Understand the protocol, its timing aspects, and verification challenges.
E N D
Applications CS 5270Lecture 7 Lecture 7
Outline • The Bounded Retransmission Protocol. • The TTA model • The verification issues • Task arrival patterns and their schedulability. • Periodic, aperiodic, sporadic tasks. • More sophisticated patterns captured by timed automata. • Timed automata can also be used for schedulabilty analysis ! • Introduction to Regional Automata Lecture 7
Case Studies • Available from the UPPAAL home page (“Examples”). • Bang & Olufsen Audio/Video Protocol. • Bang & Olufsen Power Down Protocol. • Commercial Field Bus Protocol. • Gear Box Controller. • Multimedia Stream. Lecture 7
BRP • Bounded Retransmission Protocol (BRP). • Developed by Phillips Electronics Corporation. • A real-time bounded variant of the alternating-bit protocol. • Used to transfer in burst-mode a list of data (a file) • via an infra-red communication medium between AV equipment and a remote control unit. Lecture 7
BRP • The medium is lossy! • The file is transmitted in chunks. • If an acknowledgment for a sent-chunk is not received “in time” the chunk is retransmitted. • If the number of retransmissions for the same chunk exceed a bound then the transmission is aborted. Lecture 7
BRP • Timing aspects: • The sender has a timer to decide when to retransmit a chunk. • The receiver has a timer to detect when a transmission has been aborted by the sender. Lecture 7
Sin Rout Sout Sender Receiver G F K B L A Lecture 7
(d1, d2, ,,,,dn) ; a file consisting of n chunks of data. Sin Rout Sout Sender Receiver G F K B L A Lecture 7
{IOK, INOK, IDK } Sin Rout Sout Sender Receiver G F K B L A Lecture 7
The values of Sout • IOK • All the acknowledgments were received. • All the chunks were transmitted successfully and were received by the receiver. • INOK • Some ack. failed to arrive in time ; the MAX count of retransmissions for that chunk was exhausted without receiving an ack. • IDK • The ack. Were received for all the chunks except the last one. • Don’t know whether the transmission was successful or not. • This is due to asynchronous communication via a lossy channel. • Byzantine agreement is impossible! Lecture 7
(e1, i1) (e2, i2) ….(ek, ik) Sin Rout Sout Sender Receiver G F K B L A Lecture 7
(e1, i1) (e2, i2) ….(ek, ik) (d1, d2, ,,,,dn) Sin Rout Sout Sender Receiver G F K B L A Lecture 7
Rout • (e1, i1) (e2, i2)……. (ek, ik) • 0 ≤ k ≤ n • ij2{IFST, IINC, IOK, INOK }, 0 < j ≤ k • IFST--- The first chunk of the file but not the last one. • IOK --- The last chunk of the file. • IINC --- For all other chunks. • INOK ---- Something has gone wrong. • In this case j = k and ek = * (no datum). Lecture 7
The Specification • (ej, ij) • For every 0 < j ≤ k, if ij INOK then ej = dj • The datum delivered is the chunk that was sent. • If n > 1 then i1 = IFST • INOK is put out only if something at all was received. • If 1 < j < k then ij = IINC Lecture 7
The Specification • ik = IOK OR ik = INOK • The last output must signal positive or negative termination. • ik = IOK implies k = n. • Successful transmission. • ik = INOK implies k > 1. • Unsuccessful only if something was received to start with. Lecture 7
The Specification • If Sout = IOK then ik = IOK. • Should we demand the converse too? • If Sout = INOK then ik = INOK • If Sout = IDK then k = n. • ik = ? • If k = 0 then • Sout = IDK iff n = 1. • Sout = INOK iff n > 1. Lecture 7
IOK a a b b c c (a, FST) (b, INC) (C, OK) Lecture 7
? a a b b c c (a, FST) (b, INC) (C, OK) Lecture 7
IDK a a b b c c (a, FST) (b, INC) (C, OK) Lecture 7
? a a b b ? Lecture 7
INOK a a b b (a, FST) (b, INC) (NOK, *) Lecture 7
INOK a a b (a, FST) (NOK, *) Lecture 7
INOK a Lecture 7
The Sender Module • S reads the file (with n chunks d1, d2,…, dn) and sets the retry counter to 0. • It then starts sending over the chunks one by one: • Its sets a timer T1 and the first frame into the channel K. A frame is of the form (b1, b2, ab, d). • b1 (b2) indicates whether or not this chunk is the first (last) one. ab is the alternating bit. d is the chunk. • ab is used to distinguish between a retry and a fresh chunk. Lecture 7
The Sender Module • After sending the frame (b1, b2, ab, d), the sender module waits for an acknowledgment or a time-out. • If an ack. is received in time then T1 is reset. • The next frame (b1’, b2’, 1-ab, d’) is sent or (if b2 = 1 in the previous round), it signals Rout = IOK. • If it times out, the frame (b1, b2, ab, d) is resent after resetting the timer and incrementing the retry counter. • If MAX is exceeded in the process of incrementing the counter, the transmission is broken off; it signals Rout = INOK or Rout = IDK depending on n and how many ack messages were received. Lecture 7
ab : = 0 idle Lecture 7
ab : = 0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 Lecture 7
ab : = 0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 ! (i = 1, i = n, ab, di) rc : = 0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 (i = 1, i = n, ab, di) rc:=0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 (x < T1) (?ack) x := 0; ab := 1 -ab Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 i < n i := i + 1 (x < T1) (?ack) x := 0; ab := 1 -ab x ≤ 0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 i < n i := i + 1 (x < T1) (?ack) x := 0; ab := 1 -ab i = n ! IOK x ≤ 0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 i < n i := i + 1 i = n ! IOK (x < T1) (?ack) x := 0; ab := 1 -ab x ≤ 0 (rc = MAX), x = T1, i < n ! INOK ; x := 0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 i < n i := i + 1 i = n ! IOK (x < T1) (?ack) x := 0; ab := 1 -ab x ≤ 0 (rc = MAX), x = T1, i < n ! INOK ; x := 0 (rc = MAX), x = T1, i = n ! IDK ; x := 0 Lecture 7
(rc < MAX ) (x = T1) ! (i = 1, i = n, ab, di) rc:= rc + 1; x : = 0 ab : = 0 (i = 1, i = n, ab, di) rc:=0 ? (d1, d2,..,dn) i := 1; x := 0 idle x ≤ 0 x ≤ T1 i < n i := i + 1 i = n ! IOK x = SYNCH ab := 0, (x < T1) (?ack) x := 0; ab := 1 -ab x ≤ 0 (rc = MAX), x = T1, i < n ! INOK ; x := 0 (rc = MAX), x = T1, i = n ! IDK ; x := 0 x ≤ SYNCH Lecture 7
The Receiver Module ?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 exp_ab := rab Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab =exp_ab , rb2 =1 !(IOK, d) exp_ab := rab w≤0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 w≤0 rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) !ack; exp_ab = 1 – exp_ab z:=0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 w≤0 z ≤ TR z < TR ?(rb1, rb2, rab, d) w :=0 rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) !ack; exp_ab = 1 – exp_ab z:=0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) z = TR rb2 = 1 exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 w≤0 z ≤ TR z < TR ?(rb1, rb2, rab, d) w :=0 rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) !ack; exp_ab = 1 – exp_ab z:=0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) z = TR rb2 = 1 exp_ab := rab rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 w≤0 z ≤ TR z < TR ?(rb1, rb2, rab, d) w :=0 rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) !ack; exp_ab = 1 – exp_ab z:=0 Lecture 7
?(rb1, rb2, rab, d) w≤0 z :=0; w:=0 rab = exp_ab, rb2 =1 !(IOK, d) z = TR rb2 = 0 !(INOK, *) z = TR rb2 = 1 exp_ab := rab z < TR ?(rb1, rb2, rab, d) w :=0 rab = exp_ab, rb1=0, rb2 = 0 !(IINC, d) w≤0 w≤0 z ≤ TR rab = exp_ab, rb1=1, rb2 = 0 !(IFST, d) exp-ab rab !ack !ack; exp_ab = 1 – exp_ab z:=0 Lecture 7
Verification • Premature time-outs do not occur. • In case of abortion, Sender waits sufficiently long so that the Receiver has reacted to the abortion before starting a new file. Lecture 7
Verification • Using UPPAAL it was determined: • T1 > 2 £TD • TD the transmission delay of the channel. • SYNCH TR (2 £ MAX £ T1) + 3 £ TD • Both the verifier and the simulator had to be used! Lecture 7
Task Scheduling Basic Idea: • Classical scheduling • Periodic • Aperiodic • Sporadic • Use timed automata to describe task arrivals. • Some of the control states have tasks associated with them. • Whenever a state is entered, its task is added to the ready queue. Lecture 7
Periodic Task TSK x:=0 x = T Lecture 7
Periodic Task Set TSK1 TSK2 TSK3 x:=0 x = T1 y:=0 y = T2 z:=0 z = T3 Lecture 7
The Task Arrival Model TSK = (c, d) G : X TSK’ = (c’, d’) c computation time d relative deadline Whenever a task is released, it is added to the ready queue. Scheduling is done according to some policy (EDF); uniprocessor model. Lecture 7