Finite State Machines: Protocol Specification

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Finite State Machines

Protocol Specification

CS144, Stanford University 1


Finite State Machines

State State
1 2

State
3

CS144, Stanford University 2


Finite State Machines

event causing state transition


actions taken on state transition

State State
1 2

State
3

CS144, Stanford University 3


Finite State Machines

event causing state transition


actions taken on state transition

State State
1 2
event
action
State
3

CS144, Stanford University 4


FSM Example: HTTP Request

CS144, Stanford University 5


FSM Example: TCP Connection

CS144, Stanford University 6 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/


FSM Example: TCP Connection

CS144, Stanford University 7 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/


Quiz
Assume there is no other documentation of the TCP finite state machine, so theres no
supporting textual description which defines other state transitions.

Suppose we start in the closed state, then


call listen, then receive a SYN, then call
close. What state will we be in:
CLOSED, SYN SENT, SYN RECEIVED,
ESTABLISHED, FIN WAIT 1, or undefined?

Suppose we start in the closed state, then


call connect, then call close. What state
will we be in:
CLOSED, SYN SENT, SYN RECEIVED,
ESTABLISHED, FIN WAIT 1, or undefined?

CS144, Stanford University 8 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/


Quiz
Assume there is no other documentation of the TCP finite state machine, so theres no
supporting textual description which defines other state transitions.

Suppose we start in the closed state, then


call listen, then receive a SYN, then call
close. What state will we be in:
CLOSED, SYN SENT, SYN RECEIVED,
ESTABLISHED, FIN WAIT 1, or undefined?

Suppose we start in the closed state, then


call connect, then call close. What state
will we be in:
CLOSED, SYN SENT, SYN RECEIVED,
ESTABLISHED, FIN WAIT 1, or undefined?

CS144, Stanford University 9 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/


FSM Example: TCP Connection

CS144, Stanford University 10 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/


FSM Example: TCP Connection

CS144, Stanford University 11 http://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Tcp_state_diagram_fixed.svg/

You might also like