Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Advanced Behavioral Model Part 1: Processes and Threads Part 2: Time and Space Chapter22~23 Speaker: 陳 奕 全 Real-time and Embedded System Lab 10 Oct.

Similar presentations


Presentation on theme: "1 Advanced Behavioral Model Part 1: Processes and Threads Part 2: Time and Space Chapter22~23 Speaker: 陳 奕 全 Real-time and Embedded System Lab 10 Oct."— Presentation transcript:

1 1 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

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

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

4 4 Active object and passive object Active object: is an object that owns a process or thread and can initiate control activity 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 Stereotype: process –Threads: is a lightweight flow that can execute concurrently within the same process Stereotype: thread Stereotype: thread Passive object: cannot initiate control activity Passive object: cannot initiate control activity

5 5 Active object and passive object (Cont.) In a purely sequential system: 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

6 6 Active object and passive object (Cont.) In a concurrent system: 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 In UML, an active class represents a process or thread and that is concurrent with all peer flows of control

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

8 8 Communication and synchronization (Cont.) When more than one flow of control is in one object at same time 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: 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

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

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

11 11 Time and Space Frictionless environment 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 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 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

12 12 Time and Space (Cont.) Timing mark: 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: Time expression: –is an expression that evaluates to an absolute or relative value of time

13 13 Time and Space (Cont.) Timing constraint: Timing constraint: –Is a semantic statement about the relative or absolute value of time Location: Location: –Is the placement of a component on a node

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

15 15 Modeling timing constraint Figure 23-4: modeling timing constraint Figure 23-4: modeling timing constraint

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

17 17 Modeling distribution of object and objects that migrate (Cont.) Certain classes of distributed systems will move 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 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. In response to the failure of a node or connection or to balance the load across multiple nodes.

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


Download ppt "1 Advanced Behavioral Model Part 1: Processes and Threads Part 2: Time and Space Chapter22~23 Speaker: 陳 奕 全 Real-time and Embedded System Lab 10 Oct."

Similar presentations


Ads by Google