Upload
kendall-lucas
View
26
Download
3
Embed Size (px)
DESCRIPTION
CIS 725. Lecture 2. Finite State Machine Model. FSM = (A, S, T, s 0 ) A = set of actions S = set of states s 0 = initial states T = transition relation S * A S. Communicating FSM. send actions: -m or !m q ! m = send message m to q - PowerPoint PPT Presentation
Citation preview
CIS 725
Lecture 2
Finite State Machine Model
• FSM = (A, S, T, s0) A = set of actions S = set of states s0 = initial states T = transition relation S * A S
Communicating FSM
• send actions: -m or !m q ! m = send message m to q• receive actions: +m or ? m q ? m = receive message from q • internal actions
Protocol
• A collection of CFSMs
Asynchronous coupling
• Channels ch1 = channel from M to N ch2 = channel from N to M• Global state: (q1, q2, x, y) q1 = state of M q2 = state of N x = messages in transit to M y = messages in transit to N
Protocol actions
• Each protocol action results in a change in the global state
Error states
• Deadlock states: - state from which no transition is enabled
• Unspecified reception: - a state in which a message exists in a
channel but no transition is enabled in the state to receive it.
Meeting appointment
!meeting
waiting
meeting
?OK
- Initial state: studying- Send a message for meeting- May decide to cancel anytime
studyingstudying
Two-process mutual exclusion: Token ring protocol- Single token circulates among two nodes- Node with the token can enter the critical section
Request-based Token ring protocol- To get the token, send a request to the other node
Request-based Token ring protocol
no_tokenno_token
enter exit
in_cs&req_recd
token &req_recd
?req
?req
!tokenreq_sent req_sent
tokentoken
?token
!req
?token
!req
in_cs
enter exit
in_cs
enter exit
Programming language style notation
• Guarded actions• en(a) a en(a): guard of the action boolean condition or boolean condition + receive statement
Normal form
• init; do en(a1) a1
[] en(a2) a2
: : od
Token-based system• P1: hold = false; in_cs = false do ? token hold = true [] hold /\ not in_cs ! Token; hold =false [] hold in_cs = true [] in_cs in_cs = false od