Protocol Specification Using Finite State Machines
Introduction Specification Phase of Protocol Design allows the designer to prepare an abstract model of the protocol for testing and analysis. Finite State Machine is a tool to model the desired behavior of a communciation system. The advantage of communicating finite state machines is that they make it possible to decide many properties in communication protocols, beyond the level of just detecting such properties. A FSM consists of several states. Inputs into the machine are combined with the current state of the machine to determine the new state or next state of the machine. Depending on the state of the machine, outputs are generated based on either the state or the state and inputs of the machine.
FSM
States of FSM
Transition Triggered by input events the FSM moves from one state to other based on the Transition Function Transition Function produces the Output and Next State depending on Current State and Input Event While in particular state FSM is not active, it is waiting for an input to perform next activity
The two communication mechanisms for concurrent processes can be categorized into Message Passing and Shared Data Message passing involves sending and receiving messages through a channel In the Shared Memory approach memory is common to both processes, and they can read and write to the memory
Asynchronous & Synchronous Communications Two approaches to implement message passing Synchronous Communication The processes involved in communication are required to participate at the point of communication simultaneously If Process A attempts to send a message and Process B is not ready to receive it, Process A must wait until Process B is ready Asynchronous Communication The processes involved in communication are not required to participate at the point of communication simultaneously If Process A attempts to send a message and Process B is not ready to receive it, Process A sends it anyway
Asynchronous communication requires use of buffers to store messages The protocol specification methods studied in this course will be mostly based upon Asynchronous Communication In most communicating systems, a FIFO (First In First Out) discipline is enforced on sending and receiving messages During a send event the message is appended to the end of the queue while a receive event removes a message from the front It is possible to modify the communications channel to provide additional communication constructs such as priority signals
Communicating FSMs Model Protocol is described as a set of Communicating FSMs (CFSMs) Each CFSM represents a component (or process) of the network In OSI term, a protocol entity, e.g. sender, receiver Each process can be defined by a set of states The process waits in a state for an event to occur When this input event occurs, it transfers to another state, and in doing so can send out messages and performs other tasks Each CFSM is represented by a directed labeled graph where Nodes represent states (conditions) of the process Edges represent transitions (events) of the process This model is the model used by the ITU Specification and Description Language (SDL)
Transistion diagram
Communication service specification Service Specification Service primitives Request, response, indication and confirm Service primitive parameters: data size, checksum size, caller address etc.
Components of Protocol to be specified Protocol Specification Communication services: Describes type of communication services of a protocol. (Connectionless, connection oriented), channel, signals Peer Entities: Describes the behaviour of protocol and its relation with peer enity. Interfaces: Defines the way the service primitives provides services to its upper layer and uses services from lower layers. Interactions: Message exchange betweeen two process of a protocol. Can be synch or asynch in nature. Message format: Defines sub components of message which includes data and control information
Communication service specification Data Transfer phase specification using FSM: FSM of service specification for reliable data transfer
Develop sender, receiver sides of reliable data transfer protocol (rdt) consider only unidirectional data transfer but control info will flow on both directions! use finite state machines (FSM) to specify sender, receiver
reliable transfer over a reliable channel underlying channel perfectly reliable no bit errors no loss of packets separate FSMs for sender, receiver: sender sends data into underlying channel receiver read data from underlying channel
channel with bit errors To recover from errors: acknowledgements (ACKs): receiver explicitly tells sender that pkt received OK negative acknowledgements (NAKs): receiver explicitly tells sender that pkt had errors sender retransmits pkt on receipt of NAK
FSM specification
Specification with no errors
With error
Channel specifications communication paths used to connect one or more FSMs of protocol processes. lossless or lossy channel unbounded FIFO ( first in first out)
Channel specifications two messages (m0 and m1) transfer channel representation by using a FSM. The channel has four states: 0-idle 1-buffering m0 (msg 0) 2-buffering m1(msg 1) 3-buffering ack (ack) Initially channel will be in state 0, later moves to states 1, 2 and 3 and returns back, based on certain message transitions.
Interface Specifications Internal interfaces: mechanisms that are internal to the protocol; External interfaces: mechanisms that make it possible for other implementations like applications, higher or lower layer services or both, etc., to interact with the protocol being developed. A partial protocol implementation with internal and external interfaces
FSM of an interface of bus access protocol
FSM of an interface of bus access protocol States: Idle (state 1) indicates that bus access protocol is not active; wait for bus (state 2) denotes that the protocol is waiting for bus to be idle; get data (state 3) gets the data to be transferred on the bus; write data (state 4) denotes that, it writes data on the bus; and release bus (state 5), releases the bus. Transitions: bus req makes the FSM to transit from state 1 to state 2; bus idle allows the FSM to make transit from state 2 to state 3; data ready makes the FSM to transit from state 3 to state 4; data write makes the FSM to move from state 4 to state 5; bus release allows the FSM to transit from state 5 to state 1.
Interactions FSM of interactions between ISDN system and a user for activation of call forwarding service
Multimedia protocol specifications QoS (Quality of Service) requirements of multimedia streams: Throughput: the data transmission rate data compression several Mbps (Megabits per second). Transfer Delay: time between the production of data at the source and its presentation at the sink Jitter: variance of the transfer delay use of buffers to reduce jitter Error Rates: loss of data in a continuous data transfer
Multimedia protocol specifications FSM specifications Buffer requirements
Multimedia protocol specifications FSM specifications Synchronization X number of video frames are synch with y number of audio samples
Examples of Internet protocol specifications Alternating bit window protocol The Sender_ABP takes a message which is ready to be sent and transmits the message together with a sequence number via the Data Medium to the Receiver_ABP. The Sender_ABP waits for an acknowledgment from the Receiver_ABP containing the same sequence number. If the appropriate acknowledgment arrives, the Sender_ABP performs the same procedure for the next waiting message, but this time with an inverted sequence number (i.e., 0! 1; 1! 0). If the appropriate acknowledgment does not arrive within a certain period of time (timeout period), the Sender_ABP resends the same message. The Receiver_ABP, when in an idle state, acknowledges all incoming messages. After receiving a message with a correct sequence number, it will acknowledge (through Ack Medium) only packets with the last correct sequence number until a Receive signal is received. After that, it will invert the sequence number, and go back to the idle state.
Examples of Internet protocol specifications Alternating bit window protocol
Examples of Internet protocol specifications Alternating bit window protocol ABP is a link layer protocol. Works on FIFO channels only. Guarantees reliable message delivery with a 1-bit sequence number.