ooad using the uml - describe concurrency, v 4.0 copyright 1994-1998 rational software, all...

24
OOAD Using the UML - Describe Concurrency, v 4.0 Copyright 1994-1998 Rational Software, all rights reserved 1 R Thread Thread Process X Thread Process Z Process Y Inter-process communication Intra-process communication Intra-process communication Describe Concurrency

Upload: vincent-tucker

Post on 20-Jan-2018

221 views

Category:

Documents


0 download

DESCRIPTION

OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  Rational Software, all rights reserved 3 R Architect Architectural Analysis Architectural Design Describe Concurrency Describe Distribution Review the Architecture Database Design Use-Case Analysis Subsystem Design Class Design Use-Case Design Review the Design Designer Database Designer Design Reviewer Architecture Reviewer So Where Are We?

TRANSCRIPT

Page 1: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 1 R

Thread

Thread

Process X

Thread

Process Z

Process Y

Inter-process communication

Intra-process communication

Intra-process communication

Describe Concurrency

Page 2: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 2 R

Objectives: Describe Concurrency

Understand the purpose of Describe Concurrency and Understand the purpose of Describe Concurrency and where in the lifecycle it is performedwhere in the lifecycle it is performed

Understand what a thread of control is for a systemUnderstand what a thread of control is for a system Understand how classes and subsystems are mapped to Understand how classes and subsystems are mapped to

identified processesidentified processes Model the concurrency requirements of the system in the Model the concurrency requirements of the system in the

Process ViewProcess View

Page 3: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 3 R

Architect

ArchitecturalAnalysis

ArchitecturalDesign

DescribeConcurrency

DescribeDistribution

Review theArchitecture

DatabaseDesign

Use-CaseAnalysis

SubsystemDesign

ClassDesign

Use-CaseDesign

Review theDesign

Designer

DatabaseDesigner

DesignReviewer

ArchitectureReviewer

So Where Are We?

Page 4: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 4 R

Describe Concurrency Overview

Process Model

DescribeConcurrency

SupplementarySpecifications

Page 5: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 5 R

Describe Concurrency Topics

Concurrency RequirementsConcurrency Requirements Modeling ProcessesModeling Processes Mapping Processes onto the Implementation EnvironmentMapping Processes onto the Implementation Environment Distributing Model Elements Among ProcessesDistributing Model Elements Among Processes

Page 6: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 6 R

Process View Deployment View

Logical View

Use-Case View

Implementation View

End-user Functionality Programmers

Software management

PerformanceScalabilityThroughput

System integratorsSystem topology

Delivery, installationcommunication

System engineering

Analysts/DesignersStructure

Key Concepts: The Process View

Page 7: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 7 R

Describe Concurrency Topics

Concurrency RequirementsConcurrency Requirements Modeling ProcessesModeling Processes Mapping Processes onto the Implementation EnvironmentMapping Processes onto the Implementation Environment Distributing Model Elements Among ProcessesDistributing Model Elements Among Processes

Page 8: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 8 R

Concurrency Requirements

Concurrency requirements are driven by: Concurrency requirements are driven by: The degree to which the system must be distributed The degree to which the system is event-driven The computational intensity of key algorithms The degree of parallel execution supported by the

environment Concurrency requirements are ranked in terms of Concurrency requirements are ranked in terms of

importance to resolve conflictsimportance to resolve conflicts

Page 9: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 9 R

Concurrency ApproachesApproach Advantages Disadvantages

Uni-process,no threads

- Simplicity- Fast intra-process

messaging

- Hard to balance workload- Swapping and context switches are

expensive- Can’t scale to multiple processors

Uni-process,multi-threaded

- Fast intra-process messages- Multi-tasking without inter-

process communication- Better multi-tasking without

the overhead of'heavyweight' processes

- Application must be 'thread-safe- Operating system must have

efficient thread-management- Shared memory issues need to be

considered

Multi-process - Scales well as processorsare added

- Relatively easy to distributeacross nodes

- Sensitive to process boundary: usinginter-process communication toomuch hurts performance

- Harder to design

Page 10: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 10 R

Example: Concurrency Requirements

In the Course Registration System, the requirements for In the Course Registration System, the requirements for concurrency come from the requirements and the concurrency come from the requirements and the architecture: architecture: Multiple users must be able to perform their work concurrently If a course offering becomes full while a student is building a

schedule including that offering, the student must be notified. Risk-based prototypes have found that the legacy registration

system cannot meet our performance needs without some creative use of mid-tier processing power.

Page 11: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 11 R

Describe Concurrency Topics

Concurrency RequirementsConcurrency Requirements Modeling ProcessesModeling Processes Mapping Processes onto the Implementation EnvironmentMapping Processes onto the Implementation Environment Distributing Model Elements Among ProcessesDistributing Model Elements Among Processes

Page 12: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 12 R

Key Concepts: Process and Thread

ProcessProcess Heavyweight flow of control Processes are stand-alone May be divided into individual threads

ThreadThread Lightweight flow of control Threads run in the context of an enclosing process

Page 13: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 13 R

Process Identification Considerations

Separate threads of control may be needed to: Separate threads of control may be needed to: Take advantage of multiple CPUs and/or multiple nodesTake advantage of multiple CPUs and/or multiple nodes Increase CPU utilizationIncrease CPU utilization Prioritize activitiesPrioritize activities Support load sharing Support load sharing Separate concerns between different areas of the software Separate concerns between different areas of the software Improve system availabilityImprove system availability Support major subsystemsSupport major subsystems

Page 14: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 14 R

<<stereotype>>Name

<<stereotype>>Component Name

<<stereotype>> can be <<process>> or <<thread>>

Process1.exe

Modeling Processes

Processes may be modeled using Processes may be modeled using Active classes (Class Diagrams) and Objects (Interaction

Diagrams)

Components (Component Diagrams)

Relationships<<stereotype>>

Name<<stereotype>>

Name

Page 15: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 15 R

Example: Modeling Processes: Class Diagram

(stay tuned for composition)

composition<<process>>CourseCatalogSystemAccess

<<thread>>CourseCache

<<process>>CourseRegistrationProcess

<<thread>>OfferingCache

dependency

1

1

1

1

<<process>>StudentApplication

Page 16: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 16 R

Example: Modeling Processes: Component Diagram

<<process>>CourseCatalogSystemAccess

<<thread>>OfferingCache

<<thread>>CourseCache

<<process>>CourseRegistrationProcess

dependency

<<process>>StudentApplication

Page 17: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 17 R

Describe Concurrency Topics

Concurrency RequirementsConcurrency Requirements Modeling ProcessesModeling Processes Mapping Processes onto the Implementation EnvironmentMapping Processes onto the Implementation Environment Distributing Model Elements Among ProcessesDistributing Model Elements Among Processes

Page 18: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 18 R

Mapping Processes onto the Implementation

Conceptual processes must be mapped onto specific Conceptual processes must be mapped onto specific implementation constructsimplementation constructs Process Threads

ConsiderationsConsiderations Process coupling Performance requirements System process and thread limits Existing threads and processes IPC resource availability

Page 19: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 19 R

Example: Mapping Processes to the Implementation

CourseCatalogSystemAccess

Remote

(from java.rmi)CourseRegistrationProcess

Runnable

(from java.lang) OfferingCache

Thread(from java.lang)

1

CourseCache

1

1

1

Page 20: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 20 R

Describe Concurrency Topics

Concurrency RequirementsConcurrency Requirements Modeling ProcessesModeling Processes Mapping Processes onto the Implementation EnvironmentMapping Processes onto the Implementation Environment Distributing Model Elements Among ProcessesDistributing Model Elements Among Processes

Page 21: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 21 R

Design Elements-to-Processes Considerations

Based on:Based on: Performance and concurrency requirements Distribution requirements and support for parallel execution Redundancy and availability requirements

Class/subsystem characteristics to consider:Class/subsystem characteristics to consider: Autonomy Subordination Persistence Distribution

Page 22: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 22 R

Design Elements-to-Processes Strategies

Two Strategies (used simultaneously)Two Strategies (used simultaneously) Inside-OutInside-Out

Group elements that closely cooperate, and must execute in the same thread of control

Separate elements which do not interact Repeat until minimum number of processes reached that still

provides required distribution and effective resource utilization Outside-InOutside-In

Define a separate thread of control for each external stimuli Define a separate server thread of control for each service Reduce number of threads to what can be supported

Page 23: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 23 R

Class diagramsClass diagrams Active classes as processes

Composition relationships from processes to classes

Composition relationships from processes to subsystem interfaces

Class NameProcess Name<<process>>

<<interface>>Interface Name

Process Name<<process>>

Process Name<<process>>

Modeling the Mapping of Elements to Processes

(stay tuned for Composition)

Page 24: OOAD Using the UML - Describe Concurrency, v 4.0 Copyright  1994-1998 Rational Software, all rights…

OOAD Using the UML - Describe Concurrency, v 4.0Copyright 1994-1998 Rational Software, all rights reserved 24 R

Example: Mapping Design Elements to Processes

StudentApplication<<process>> MainStudentForm

(from Student Interface)

<<boundary>>

1 1

CourseRegistrationProcess<<process>> RegistrationController

(from Registration)

<<control>>

1 1

CourseCatalogSystemAccess<<process>> CourseCatalog

(from CourseCatalog)

<<subsystem>>1 1

CourseCache<<thread>>

1

1

Course(from University Artifacts)

<<entity>>0..*1

OfferingCache<<thread>>

1

1

CourseOffering(from University Artifacts)

<<entity>> 0..* 1