E N D
Introduction to SDL Bibliography: [Doldi2001] L. Doldi, (2001), SDL Illustrated.[Edwards2001] S. Edwards, (2001), SDL, http://www.cs.columbia.edu/~sedwards/classes/2001/w4995-02/presentations/sdl.ppt.[ABS2002] A. Alkhodre, J.-P. Babau, and J.-J. Schwarz, "Modelling of real-time constraints using SDL for embedded systems design," Computing & Control Engineering Journal, vol. 13, pp. 189-196, 2002.
SDL: Specification and Description Language • ITU-T (International Telecommunication Union) Recommendation Z.100 • Created for the specification of communication protocols • Two forms: Textual (SDL/PR) et Graphic (SDL/GR)
SDL • Two aspects: • Structure of a specification in SDL • Behavior of a specification in SDL
Structure: Basic components • Three basic components in SDL • System • Block • Process
Communication in SDL • Signal • Models an event that is communicated between processes, blocks, or systems • Channel • Models the means of transferring a signal between two blocks, or a block and the external environment • Signal route • Models the means of transferring a signal between two processes
SDL Signals • General format: Signal_name(parameters) • Simplest format • start • Format with values • A(true) (message with a Boolean argument) • dial(number) • get_request(file, username) • Parameters in SDL can be rather complex if necessary (supports ASN.1)
Signal address • Source address (process that sent it) • Useful when there are more than one instance of the same process • e.g., in the case of a server that handles many requests from different clients, each request can be run in a separate concurrent process, which are different instances of the same process
SDL Channels • Signal channel, between blocks • communication delays are uncertain • Signal route, in the same block (computer), between processes • Almost instantaneous
SDL Channels (2) • A signal can travel across several channels on its way from the source to destination
SDL: Behavior • A process in SDL is modeled as a finite-state machine (actually extended, communicating FSM). • System behavior • A process can be created or terminated dynamcially
Specification in SDL • An SDL specification is a group of communicating modules • An SDL specification is a group of ECFSM (extended communication finite-state machines)
Finite State Machines • A finite state machine has: • States • Inputs (events) • Transition function • Outputs (events) • Examples…
(Some) properties of FSM • Deterministic • Non-deterministic • Complete • Partial • Connected • …
Extended Finite State Machine • It’s an FSM that has state variables • For complex problems, the state-space can explode • Can be reduced by using state variables • 3 additional features • Input/Output events can have parameters • Use of predicates for firing transitions • Variables can be modified during a transition • Examples…
Extended Communicating Finite State Machine (ECFSM) • It’s an EFSM that can communicate with other EFSM • Each EFSM has it’s own (input) queue • If M1 sends a message to M2, the message is put in M2’s queue
1 1 +B -A +A -C -B 2 2 M2 ECFSM: Example - Means a message is sent + means a message is received M1
SDL Process • A process in SDL is an ECFSM • Execution rule: take the next signal (message) from the queue and... • Update variables • Process branch decisions • Send a new signal • … • Determine the next state • End
Money Cancel SDL Process (2) • Text and graphic forms state Wait; input Money(a); task x := a; nextstate Pay; input Cancel; nextstate Wait; endstate; Wait x := a Wait Pay
SDL Process (3) • Transition rules • At any given state, remove a signal from the input queue • If a transition is defined for this signal, then • Fire the transition • Output signal(s) • Modify internal variables, etc. • Else (no transition defined for this signal) • Ignore the signal and stay in the same state
State symbol • Indicates either the current state or the next state, depending on its use inactive ready
Start State • Indicates the start of a process • Nameless ... ready
Coin Choice Clear Receive symbol • Follows a State symbol • Indicates the Signal activating a transition [Edwards2001] Idle ... ... ...
Receiving a signal • Set of valid signals • Contains all signals a process can receive • Any signal not in this set will produce an error • At a given state, only certain signals can activate a transition • If a (valid) signal is received but it has no defined transition, the signal is destroyed without causing a transition • This is called an implicit transition
Coin Clear Save symbol • Allows a signal to be accepted and stored again into the input queue (without losing it) • Useful when signals can get re-ordered [Edwards2001] A “Choice” signal that arrives in this state will be deferred to the next Idle Choice
Output symbol • Sends a signal to another process • Explicit forms « VIA channel » et « TO process » • The channel by which the signal is sent is determined by the signal’s type A(s)
Explicit output • VIA channel or TO process • e.g., a process that needs to resend the same signal it has received • To avoid receiving again the same signal, a channel can be specified • There are other cases… “VIA” the channel named MB
Local variables • A process has local variables • Shared variables • Modified only by the process itself • Read by other processes (in certain cases) • Declared textually
Important! There are no global variables in SDL!!!
Variable types • integer, Boolean, real, character, string • Operators +, -, *, etc. • Arrays, enumerations et sets
Task symbol • Assignment statements, expressions • Informal text • Incomplete specification, to be detailed later • Useful during simulation
Decision symbol • Branch according to a condition • Expression form a=e • Informal ‘message’
Process Creation symbol • Creates (instantiates) a new process after a transition • Channels aren’t duplicated • Make sure that a message is sent to the right instance • Specification of the number of instances CallHandler CallHandler(0,63) [Edwards2001]
Process creation • Convention: independent handling of a request • Like a daemon in Unix (lpd, httpd, etc.) • e.g., create a new server process to handle a file-transfer request • The process “dies” when the file has been sent • Set the maximum number of process instances because resources are limited
Process creation • Process is running at all times (one and only one instance) • Process starts out as inactive. No more than one instance. • No processes running at first, but up to 64 instances. CallHandler(1,1) CallHandler(0,1) CallHandler(0,64)
Terminating a process • Only a process can terminate ‘last task’
T B(r) Timers A(s) Timer T; set (now+10, T) Duration of timer is specified here A timer is declare like a variable att_ack Once a timer has expired, the process receives a message. A(s) reset(T) ... Timer is deactivated ...
SDL: Inside information… • SDL has two “close cousins” • ASN.1 • MSC • They are always together on projects that are serious.
Exercise • http://www.comnets.uni-bremen.de/typo3site/uploads/media/Exercise6.pdf