Interaction diagrams and activity diagrams by yurtgc548

VIEWS: 12 PAGES: 18

									Advanced Behavioral Model
      Part 1: Processes and Threads

         Part 2: Time and Space


           Chapter22~23

         Speaker: 陳 奕 全
Real-time and Embedded System Lab
            10 Oct. 2002

                                      1
Outline
•   Introduction
•   Active object and passive object
•   Communication and Synchronization
•   Modeling multiple flows of control and Inter-
    process communication
•   Time and space
•   Modeling timing constraint
•   Modeling distribution of object and objects that
    migrate

                                                       2
  Introduction
• How to model a system of the real world?
  – Process view
     • The processes and threads: form the system’s concurrency and
       synchronization mechanism
• Why need communication and synchronization?
  – Share certain resources
     • Ex, If hundreds of people work in the same building. All must share
       the same facilities
• In UML, an active object help us to synchronize the
  interactions among independent flows

                                                                       3
Active object and passive object
• Active object: is an object that owns a process
  or thread and can initiate control activity
   – Process: is a heavyweight flow that can execute
     concurrently.
      • Stereotype: process
   – Threads: is a lightweight flow that can execute
     concurrently within the same process
      • Stereotype: thread
• Passive object: cannot initiate control activity

                                                       4
Active object and passive object
(Cont.)
• In a purely sequential system:
  – Only one flow of control (one thing only can
    take place at a time)
  – Execution flow from one statement to
    another, in sequential order
  – If there is any recursion, iteration, branch,
    loop and jump, the flow circle back on itself



                                                    5
Active object and passive object
(Cont.)
• In a concurrent system:
  – More than one flow of control (more than onw
    thing can take place at a time)
  – Each flow of control root at the head of an
    independent process or thread
• In UML, an active class represents a
 process or thread and that is concurrent
 with all peer flows of control

                                               6
Communication and synchronization
• Communication: objects interact by passing messages
  from one to the other
• Four possible combinations of interaction:
   – Passive object to passive object
       • Assuming there is only one flow of control passing through these
         objects at a time
   – Active object to active object
       • Inter-process communication
           – Synchronously call
           – Asynchronously call
   – Active object to passive object

   – Passive object to passive object



                                                                            7
Communication and synchronization
(Cont.)
• When more than one flow of control is in one
  object at same time
  – Mutual exclusion
• In UML, there are three alternatives to achieve
  critical region:
  – Sequential: only one flow is in the object at a time
  – Guarded: sequentializing all calls to all guarded
    operations to ensure semantics and integrity
  – Concurrent: the presence of multiple flows of control
    by treating the operation as atomic

                                                            8
Modeling multiple flows of control
and Inter-process communication
• Common modeling techniques: chapter 22,
    page 317~320
•   Figure 22-4: Modeling flows of control




                                             9
Modeling multiple flows of control
and Inter-process communication
(Cont.)
• Figure 22-5: Modeling inter-process
  communication




                                        10
Time and Space
• Frictionless environment
   –   Messages are sent in zero time
   –   Network never go down
   –   Workstations never fail
   –   And so on
• But the real world doesn’t work that way
   – Have to take into account the issues of time and space
• To represent the modeling needs of real-time and
  distributed systems, the UML provides a graphic
  representation for timing marks, time expressions,
  timing constraints, and location


                                                              11
Time and Space (Cont.)

• Timing mark:
  – A denotation for the time at which an event
    occurs
  – Graphically, it is formed as an expression from
    the name given to the message
• Time expression:
  – is an expression that evaluates to an absolute
    or relative value of time

                                                 12
Time and Space (Cont.)

• Timing constraint:
  – Is a semantic statement about the relative or
    absolute value of time
• Location:
  – Is the placement of a component on a node




                                                    13
Time and Space (Cont.)
• Figure 23-1: timing constraints and location




                                                 14
Modeling timing constraint
• Figure 23-4: modeling timing constraint




                                            15
Modeling distribution of object and
objects that migrate
• Consider the physical placement of both components and class
  instances
• Figure 23-5:Modeling the distribution of objects




                                                                 16
Modeling distribution of object and
objects that migrate (Cont.)
• Certain classes of distributed systems will
 move
  – Two reasons:
     • In order to move closer to actors and other objects
       they need to work with to do their job better
     • In response to the failure of a node or connection
       or to balance the load across multiple nodes.




                                                            17
Modeling distribution of object and
objects that migrate (Cont.)
• Figure 23-6 : Modeling objects that migrate




                                                18

								
To top