100 likes | 318 Views
Introduction to AP Notation. So far we have discussed the Internet Protocol informally Now, we need to learn about a formal notation, called the Abstract Protocol notation (AP notation for short), that can be used in specifying network protocols formally
E N D
Introduction to AP Notation • So far we have discussed the Internet Protocol informally • Now, we need to learn about a formal notation, called the Abstract Protocol notation (AP notation for short), that can be used in specifying network protocols formally • Later, we use this notation to formally specify many interesting protocols
A Protocol in AP Notation channel pq • A channel pq is an unbounded, FIFO queue for storing all messages sent by p until each of them is received by q • Next, we discuss a protocol in AP notation process q process p channel qp
The Request/Reply Protocol • It is between two processes p and q • Each process can send request message to the other process • When a process receives a request message from the other process, it sends back a reply message
Problems and Remedies ofRequest/Reply Protocol • Number of request messages in the two channels can grow beyond any bound? At every instant, each process is either ready or not ready; a ready process can send one request message to the other process and become not ready • How to make a process ready once it has become not ready? When a process receives a reply message, it becomes ready
The Architecture of Request/Reply Protocol channel pq process q • Each process has a variable: readyp in process p and ready q in process q • Variable readyp in p has a value true iff p can send the next request message to q • Variable readyp in p becomes false after p sends a request message to q and before p receives next reply message from q process p readyp readyq channel qp
Process p process p var readyp : boolean {initially true} begin <action> [] <action> … [] <action> end • Each <action> consists of three components <guard> <statement>
Actions of Process p process p var readyp : boolean {initially true} begin readyp send request to q; readyp := false [] rcv request from q send reply to q [] rcv reply from q readyp := true end • Process q is symmetric; just change each appearance of p to q • Next, we introduce the concept of network state and discuss how a network of processes is executed
Network State • A network state is defined by one value for each constant, input, variable in each process in network and by the content of each channel in network • An action gd sm in a process p in network is enabled at a network state S iff • gd is a local or timeout guard whose value is true at S; or • gd is of the form rcv m from q and the first message in channel from q to p is m at S
Three Conditions of Network Execution • Nondeterministic selection: At a network state, any enabled action can be selected for execution • Action atomicity: Enabled actions are executed one at a time • Fair execution: to be discussed later
Network States of Request/Reply Protocol S.0 = readyp readyq ch.p.q=<> ch.q.p=<> S.1 = ~readyp readyq ch.p.q=<request> ch.q.p=<> S.2 = readyp ~readyq ch.p.q=<> ch.q.p=<request> S.3 = ~readyp readyq ch.p.q=<> ch.q.p=<reply> S.4 = ~readyp ~readyq ch.p.q=<request> ch.q.p=<request> S.5 = readyp ~readyq ch.p.q=<reply> ch.q.p=<> S.6 = ~readyp ~readyq ch.p.q=<> ch.q.p=<reply;request> S.7 = ~readyp ~readyq ch.p.q=<reply; request> ch.q.p=<> S.8 = ~readyp ~readyq ch.p.q=<> ch.q.p=<request;reply> S.9 = ~readyp ~readyq ch.p.q=<request; reply> ch.q.p=<> S.10=~readyp ~readyq ch.p.q=<reply> ch.q.p=<reply> S.0 S.1 S.2 S.3 S.4 S.5 S.6 S.7 S.8 S.9 S.10