Cover image for Doing hard time : developing real-time systems with UML, objects, frameworks, and patterns
Title:
Doing hard time : developing real-time systems with UML, objects, frameworks, and patterns
Author:
Douglass, Bruce Powel.
Personal Author:
Publication Information:
Reading, Mass. : Addison-Wesley, [1999]

©1999
Physical Description:
xxxiii, 766 pages ; 24 cm. 1 computer optical disc.
Language:
English
ISBN:
9780201498370
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Item Holds
Searching...
QA76.6 .D655 1999 TEXT Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

This book will almost certainly become a seminal work in this field...the one book everyone will want to have both as a tutorial and as a reference. --Larry McAlister, Senior Systems Architect, ENSCO, Inc. The global demand for real-time and embedded systems is growing rapidly. With this increased demand comes an urgent need for more programmers in this realm; yet making the transition to real-time systems development or learning to build these applications is by no means simple. Real-time system designs must be written to meet hard and unforgiving requirements. It is a pursuit that requires a unique set of skills. Clearly, real-time systems development is a formidable task, and developers face many unique challenges as they attempt to do hard time. Doing Hard Time is written to facilitate the daunting process of developing real-time systems. It presents an embedded systems programming methodology that has been proven successful in practice. The process outlined in this book allows application developers to apply practical techniques--garnered from the mainstream areas of object-oriented software development--to meet the demanding qualifications of real-time programming. Bruce


Author Notes

Bruce Powel Douglass has worked as a software developer in real-time systems for almost twenty years. He is employed as Chief Evangelist for l-Logix, where he has been working closely with Rational and the other UML partners on the UML specification. He is on the Advisory Boards of the Embedded Systems Conference and the UML World Conference and has taught his own commercial real-time object-oriented courses for more than seven years. He is also the author of Real-Time UML (Addison-Wesley, 1998).


Excerpts

Excerpts

Goals Today's world literally runs on embedded computers. Virtually every field of endeavor in our modern society depends on embedded computers from manufacturing to transportation to medicine. The typical household is a computing eco-system that includes telephones, televisions, washing machines, ovens, and a host of other silicon-based fauna. Many, if not most, of these computing devices have timeliness requirements to their functionality, so that late action is often wrong action. Many embedded devices have the capacity to do great harm if they malfunction or fail. Not only are more things being handled by embedded computing devices, but the scope, complexity, and criticality of the things being handled is increasing geometrically. Technological advances are crucial in order to keep up with the increasing demands on the developer of such systems. Gone are the days when the hardware complexity was the limiting factor in the development of electrical devices. Most companies involved in the manufacture of real-time and embedded systems have realized the truism of "the tail that wags the dog" and have begun seriously looking at ways to improve software productivity. These better ways to develop real-time and embedded systems are the source and soul of this book. Doing Hard Time: Designing and Implementing Embedded Systems with UML focuses on model-based development of real-time and embedded systems using the Unified Modified Language (UML) and a risk-based iterative development lifecycle called ROPES. UML is a 3rd generation modeling language that rigorously defines the semantics of the object metamodel and provided a notation for capturing and communicating object structure and behavior. The UML became a standard modeling language in the OMG in late 1996, and the author remains heavily involved in its ongoing effort. This book is based upon the 1.3 revision of the UML standard. Model-based development is crucial in today's high-complexity, short-development-cycle business environment. It is important to focus on the fundamental abstractions of the problem rather than on the low-level details of its implementation; to focus on "should the control rods be in the reactor core to avoid a meltdown?" rather than "should I jump on non-zero or carry?" By increasing the level of abstraction, it is possible to build more complex systems with fewer defects in less time--a winning combination for everyone concerned. Because the UML is executable, it is possible to automatically generate executable systems from UML models. The importance of this goes well beyond simply saving the time and effort of hand-translating code from abstract models. It is an enabling technology, allowing the developer to rapidly move from the inception of a concept to the testing of that concept. This allows early risk reduction and encourages exploration of the solution space. Conceptual defects can be identified and fixed very early before many dependencies on the flawed concepts are created, resulting in higher-quality systems in less calendar time. This book is meant to be a fusion of a number of subject domains almost universally left disjoint--real-time concepts such as timeliness and performance, object modeling, a rapid development process, and system safety. This unified approach allows the developer to follow simple and well-understood process steps culminating with the delivery of correct and timely embedded solutions. There are very few books on using objects in real-time systems and even fewer that use the latest in object modeling languages--the UML. Virtually all object-oriented books focus primarily on business or data base application domains and do not mention real-time aspects at all. On the other hand, texts on real-time systems have largely ignored object-oriented methods. For the most part, such books fall into two primary camps: those that bypass methodological considerations altogether and focus solely on "bare metal" programming and those that are highly theoretical with little advice for actually implementing workable systems. Doing Hard Time is meant to bridge for these technologies, presenting the development of deployable real-time systems using the object semantics and notation of the UML. It does so in a tool-independent manner, even though it does use a particular tool to demonstrate the examples. Audience The book is oriented towards the practicing professional software developer and the computer science major, in the junior year or higher. The book could serve as an undergraduate or graduate level text, but the focus is on practical development rather than a theoretical introduction. A few equations are to be found in this book, but more theoretical and mathematical approaches are referenced where appropriate. The book assumes a reasonable proficiency in at least one programming language and at least a cursory exposure to the fundamental concepts of both object orientation and real-time systems. Organization This book is organized into 5 sections: The Basics This section introduces the object semantics and notation of the UML, real-time systems, safety criticality, and development processes. Analysis This section deals with the various kinds of analysis, including the capturing of requirements with use cases, scenarios, and state machines, the identification of the key abstractions in a problem, and modeling the fundamental behavior. Design This section focuses on the addition of design level information, such as the concurrency model, creation of run-time artifacts (libraries, executables, and so on), mapping to physical architectures, the application of design patterns to optimize collaborations of objects, and modeling of algorithms. Advanced Real-Time Modeling This section discusses topics of interest in difficult or complex real-time and embedded applications. These topics include the determination of the schedulability of object models through mathematical analysis, the reification of general state machine solutions to commonly occurring behavioral problems into behavioral design patterns, and the structure and function of real-time frameworks. Appendices This book provides three appendices: UML Notational Guide: A short guide to the notations used in the UML and in the book. Introduction to Rhapsody: An introduction to the UML visual programming tool provided in the accompanying CD-ROM. Introduction to TimeWiz: An introduction to the schedulability analysis tool provided in the accompanying CD-ROM. CD-ROM The CD-ROM provided with this book contains three kinds of things: The examples presented within the pages of the book These models are given as Rhapsody projects and can be opened and manipulated with Rhapsody. Rhapsody The visual programming tool installation files. TimeWiz The schedulability analysis tool installation files. I believe (and hope) that the needs of both the student and professional developer will be addressed by this book, and it is in this spirit that I offer it. Acknowledgments I wish to express thanks to my reviewers who tried hard to keep me honest and on topic, and who, I think, more or less succeeded: Eran Gery, i-Logix Jim Collins, i-Logix Larry McAlister, ENSCO, Inc. Therese M. Douglass, Air Traffic Software Architecture, Inc. Gary Cernosek, Rational Software Corp. I would also like to thank Neeraj Chandra and Gene Robinson of i-Logix for their support in allowing me to spend so much effort on this book, Doug Jensen of Mitre for his input on schedulability, Therese Douglass for her expertise in air traffic control systems, and the editorial team at Addison-Wesley, including Carter Shanklin, Krysia Bebick, and Maureen Willard, to name a few. Bruce Powel Douglass, Ph.D. Deep, Dark Winter, (early) 1999 0201498375P04062001 Excerpted from Doing Hard Time: Developing Real-Time Systems with UML, Objects, Frameworks and Patterns by Bruce Powel Douglass All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Table of Contents

Figure Listp. xvii
About the Authorp. xxv
Forewordp. xxvii
Prefacep. xxix
Acknowledgmentsp. xxxiii
Part I The Basicsp. 1
Chapter 1 Introduction to Objects and the Unified Modeling Languagep. 3
1.1 Advantages of Objectsp. 4
1.2 Terms and Conceptsp. 10
1.3 Object Orientation with the UMLp. 11
1.3.1 Objectsp. 12
1.3.2 Attributesp. 20
1.3.3 Behaviorp. 20
1.3.4 Messagingp. 22
1.3.5 Responsibilityp. 24
1.3.6 Concurrencyp. 24
1.3.7 Objects as Autonomous Machinesp. 25
1.4 Class Diagramsp. 26
1.4.1 Relations among Classes and Objectsp. 30
1.5 Use Casesp. 38
1.6 Sequence Diagramsp. 40
1.7 Physical Representationp. 42
1.8 Things Common to Diagramsp. 44
1.8.1 Notesp. 44
1.8.2 Packagesp. 45
1.8.3 Constraintsp. 45
1.8.4 Stereotypesp. 46
1.9 Summaryp. 52
1.10 A Look Aheadp. 54
1.11 Exercisesp. 54
1.12 Referencesp. 55
Chapter 2 Basic Concepts of Real-Time Systemsp. 57
2.1 What is Real-Time?p. 58
2.2 Terms and Conceptsp. 58
2.3 Timelinessp. 60
2.4 Responsivenessp. 64
2.5 Concurrencyp. 67
2.5.1 Scheduling Concurrent Threadsp. 67
2.5.2 Event Arrival Patternsp. 68
2.5.3 Thread Rendezvous Patternsp. 70
2.5.4 Sharing Resourcesp. 71
2.6 Predictabilityp. 73
2.6.1 Memory Managementp. 73
2.7 Correctness and Robustnessp. 75
2.7.1 Deadlockp. 75
2.7.2 Exceptional Conditionsp. 77
2.7.3 Race Conditionsp. 79
2.8 Distributed Systemsp. 81
2.9 Fault Tolerance and Safetyp. 81
2.10 Dealing with Resource-Limited Target Environmentsp. 82
2.11 Low-Level Hardware Interfacingp. 83
2.12 Real-Time Operating Systemsp. 83
2.13 Summaryp. 95
2.14 Looking Aheadp. 95
2.15 Exercisesp. 95
2.16 Referencesp. 96
Chapter 3 Basic Concepts of Safety-Critical Systemsp. 97
3.1 Introduction to Safetyp. 98
3.1.1 The Therac-25 Storyp. 98
3.1.2 Other Storiesp. 98
3.2 Terms and Conceptsp. 100
3.3 Safety-Related Faultsp. 103
3.3.1 Safety Is a System Issuep. 104
3.3.2 Random Faults vs. Systematic Faultsp. 104
3.3.3 Single-Point Failuresp. 105
3.3.4 Common Mode Failuresp. 107
3.3.5 Latent Faultsp. 110
3.3.6 Fail-Safe Statep. 110
3.3.7 Achieving Safetyp. 111
3.4 Safety Architecturesp. 114
3.4.1 Single-Channel Protected Design (SCPD)p. 114
3.4.2 Multi-Channel Voting Patternp. 117
3.4.3 Homogeneous Redundancy Patternp. 117
3.4.4 Diverse Redundance Patternp. 119
3.4.5 Monitor-Actuator Patternp. 119
3.4.6 Watchdog Patternp. 122
3.4.7 Safety Executive Patternp. 123
3.5 Eight Steps to Safetyp. 125
3.5.1 Step 1: Identify the Hazardsp. 125
3.5.2 Step 2: Determine the Risksp. 131
3.5.3 Step 3: Define the Safety Measuresp. 133
3.5.4 Step 4: Create Safe Requirementsp. 134
3.5.5 Step 5: Create Safe Designsp. 135
3.5.6 Step 6: Implementing Safetyp. 136
3.5.7 Step 7: Assure Safety Processp. 141
3.5.8 Step 8: Test, Test, Testp. 143
3.6 A Few Safety-Related Standardsp. 145
3.6.1 Some Important Safety Standardsp. 146
3.7 Summaryp. 147
3.8 Looking Aheadp. 148
3.9 Exercisesp. 148
3.10 Referencesp. 150
Chapter 4 Rapid Object-Oriented Process for Embedded Systemsp. 151
4.1 Introductionp. 152
4.2 Terms and Conceptsp. 153
4.2.1 Development Phasesp. 153
4.2.2 Orderingp. 156
4.2.3 Maturityp. 157
4.3 Development-Task Sequencingp. 157
4.3.1 Waterfall Lifecyclep. 158
4.3.2 Iterative Lifecyclesp. 158
4.3.3 Prototypingp. 160
4.4 Scheduling and Estimationp. 162
4.4.1 Advantages of Accurate Schedulesp. 164
4.4.2 Difficulties of Accurate Schedulingp. 165
4.5 The ROPES Macro Cyclep. 167
4.6 Analysisp. 171
4.6.1 Requirements Analysisp. 171
4.6.2 Systems Analysisp. 176
4.6.3 Object Analysisp. 180
4.7 Designp. 185
4.7.1 Architectural Designp. 188
4.7.2 Mechanistic Designp. 190
4.7.3 Detailed Designp. 191
4.8 Translationp. 192
4.8.1 Activitiesp. 192
4.8.2 Artifactsp. 194
4.9 Testingp. 195
4.9.1 Activitiesp. 195
4.9.2 Artifactsp. 196
4.10 Summaryp. 197
4.11 Looking Aheadp. 198
4.12 Exercisesp. 198
4.13 Referencesp. 199
Part II Analysisp. 201
Chapter 5 Requirements Analysis of Real-Time Systemsp. 203
5.1 Introductionp. 204
5.2 Terms and Conceptsp. 204
5.2.1 Use Casesp. 204
5.2.2 Messages and Eventsp. 206
5.2.3 Scenarios, Protocols, and State Machinesp. 208
5.3 Use Casesp. 211
5.3.1 Use Case Relationsp. 212
5.3.2 Use Case Example: Air Traffic Control Systemp. 213
5.4 External Eventsp. 218
5.4.1 Context-Level Messagesp. 219
5.5 Specifying External Messagesp. 221
5.5.1 External Event Listp. 222
5.5.2 Response Timep. 223
5.6 Detailing Use Case Behaviorp. 225
5.6.1 Informal Textual Descriptionp. 226
5.6.2 Scenariosp. 227
5.6.3 Sequence Diagramsp. 228
5.6.4 Statecharts for Defining Use Case Behaviorp. 231
5.7 Identifying Use Casesp. 232
5.8 Using Use Casesp. 233
5.9 Heuristics for Good Requirements Analysis Diagramsp. 234
5.9.1 Use Case Diagram Heuristicsp. 235
5.9.2 Use Case Heuristicsp. 235
5.9.3 Use Case Sequence Diagram Heuristicsp. 236
5.10 Summaryp. 237
5.11 Looking Aheadp. 237
5.12 Exercisesp. 237
5.13 Referencesp. 238
Chapter 6 Structural Object Analysisp. 239
6.1 Introductionp. 240
6.2 Terms and Conceptsp. 240
6.3 Key Strategies for Object Identificationp. 242
6.3.1 Underline the Nounsp. 245
6.3.2 Identify Causal Agentsp. 249
6.3.3 Identify Coherent Servicesp. 250
6.3.4 Identify Real-World Itemsp. 250
6.3.5 Identify Physical Devicesp. 251
6.3.6 Identify Essential Abstractions of Domainsp. 252
6.3.7 Identify Transactionsp. 254
6.3.8 Identify Persistent Informationp. 255
6.3.9 Identify Visual Elementsp. 256
6.3.10 Identify Control Elementsp. 256
6.3.11 Execute Scenarios on the Object Modelp. 259
6.4 Reification of Objects into Classesp. 262
6.5 Identify Object Associationsp. 264
6.5.1 Multiplicityp. 268
6.5.2 Associations and Linksp. 269
6.6 Aggregation and Compositionp. 269
6.7 Object Attributesp. 270
6.8 Generalization Relationshipsp. 272
6.9 AATCS Example: Class Diagramsp. 279
6.10 Heuristics for Good Class Diagramsp. 284
6.10.1 Rules for Good Class Diagramsp. 286
6.11 Summaryp. 289
6.12 Looking Aheadp. 289
6.13 Exercisesp. 290
6.14 Referencesp. 290
Chapter 7 Behavioral Object Analysisp. 291
7.1 Introductionp. 292
7.2 Terms and Conceptsp. 292
7.2.1 Simple Behaviorp. 293
7.2.2 State Behaviorp. 293
7.2.3 Continuous Behaviorp. 298
7.3 UML Statechartsp. 310
7.3.1 Basic State Semanticsp. 310
7.3.2 Transitions and Eventsp. 312
7.3.3 Actions and Activitiesp. 314
7.3.4 Pseudostatesp. 319
7.3.5 Orthogonal Regions and Synchronizationp. 321
7.3.6 Basic Statecharts Syntaxp. 322
7.3.7 Inherited State Modelsp. 328
7.3.8 Ill-Formed State Modelsp. 330
7.3.9 Example: AATCS Alarm Systemp. 332
7.4 The Role of Scenarios in the Definition of Behaviorp. 338
7.4.1 Timing Diagramsp. 339
7.4.2 Sequence Diagramsp. 342
7.4.3 Activity Diagramsp. 343
7.5 Defining Operationsp. 349
7.5.1 Types of Operationsp. 351
7.5.2 Strategies for Defining Operationsp. 354
7.6 Statechart Heuristicsp. 357
7.7 Timing-Diagram Heuristicsp. 358
7.8 Activity-Diagram Heuristicsp. 359
7.9 Summaryp. 359
7.10 Looking Aheadp. 360
7.11 Exercisesp. 360
7.12 Referencesp. 362
Part III Designp. 363
Chapter 8 Architectural Designp. 367
8.1 Introductionp. 368
8.2 Terms and Conceptsp. 368
8.3 Tasking Modelp. 369
8.3.1 Representing Tasksp. 370
8.3.2 Defining Task Threadsp. 381
8.3.3 Assigning Objects to Tasksp. 385
8.3.4 Defining Task Rendezvousp. 386
8.4 Component Modelp. 392
8.5 Deployment Modelp. 400
8.5.1 Representing Physical Architecture in the UMLp. 401
8.5.2 Multiprocessor Systemsp. 404
8.6 Safety/Reliability Modelp. 409
8.7 Summaryp. 417
8.8 Looking Aheadp. 418
8.9 Exercisesp. 419
8.10 Referencesp. 419
Chapter 9 Mechanistic Designp. 421
9.1 Introductionp. 421
9.2 Terms and Conceptsp. 427
9.2.1 Design-Pattern Basicsp. 434
9.3 Mechanistic Design Patternsp. 438
9.3.1 Correctness Patternsp. 439
9.3.2 Execution Control Patternsp. 445
9.4 Summaryp. 465
9.5 Looking Aheadp. 467
9.6 Exercisesp. 467
9.7 Referencesp. 467
Chapter 10 Detailed Designp. 469
10.1 Introduction to Detailed Designp. 470
10.2 Terms and Conceptsp. 471
10.3 Data Structurep. 472
10.3.1 Primitive Representational Typesp. 472
10.3.2 Subrange Constraintsp. 476
10.3.3 Derived Attributesp. 481
10.3.4 Data-Collection Structurep. 484
10.4 Associationsp. 485
10.5 The Object Interfacep. 489
10.6 Definition of Operationsp. 491
10.7 Detailed Algorithmic Designp. 493
10.7.1 Representing Algorithms in the UMLp. 494
10.7.2 Algorithmic Example: Run-Time Data Interpolationp. 495
10.8 Exceptionsp. 505
10.8.1 Source Language-Based Exception Handlingp. 507
10.8.2 State-Based Exception Handlingp. 511
10.9 Summaryp. 512
10.10 Looking Aheadp. 513
10.11 Exercisesp. 514
10.12 Referencesp. 514
Part IV Advanced Real-Time Object Modelingp. 515
Chapter 11 Threads and Schedulabilityp. 517
11.1 Introductionp. 518
11.2 Terms and Conceptsp. 518
11.2.1 Time-Based Systemsp. 518
11.2.2 Reactive Systemsp. 519
11.2.3 Time Conceptsp. 520
11.3 Scheduling Threadsp. 531
11.3.1 Rate Monotonic Schedulingp. 536
11.3.2 Earliest-Deadline-First Schedulingp. 537
11.3.3 Least Laxity Dynamic Schedulingp. 538
11.3.4 Maximum-Urgency-First Schedulingp. 538
11.3.5 Weighted Shortest-Processing-Time-First (WSPTF) Schedulingp. 539
11.3.6 Minimizing Maximum Lateness Schedulingp. 540
11.4 Thread Synchronization and Resource Sharingp. 541
11.4.1 Mutual-Exclusion Semaphoresp. 543
11.4.2 Dekker's Algorithmp. 544
11.4.3 Spinlocksp. 547
11.4.4 Counting Semaphoresp. 547
11.4.5 Condition Variablesp. 549
11.4.6 Barriersp. 551
11.4.7 Rendezvous Objectsp. 553
11.5 Schedulability Analysis of Hard Real-Time Systemsp. 553
11.5.1 Global Analysisp. 554
11.5.2 Global Method with Task Blockingp. 557
11.5.3 Computing Blockingp. 561
11.5.4 Separate Task Utilization Boundsp. 563
11.5.5 Aperiodic Tasksp. 565
11.6 Schedulability Analysis of Soft Real-Time Systemsp. 566
11.6.1 Warm and Fuzzy: Timeliness in the Soft Contextp. 567
11.6.2 Soft Schedulabilityp. 570
11.7 Summaryp. 572
11.8 Looking Aheadp. 573
11.9 Exercisesp. 574
11.10 Referencesp. 576
Chapter 12 Dynamic Modelingp. 577
12.1 Introductionp. 578
12.2 Terms and Conceptsp. 578
12.2.1 But Is It the Right State Machine?p. 581
12.3 Behavioral Patternsp. 588
12.3.1 Latch State Patternp. 589
12.3.2 Polling State Patternp. 593
12.3.3 Latched Data Patternp. 593
12.3.4 Device Mode State Patternp. 594
12.3.5 Transaction State Patternp. 596
12.3.6 Component Synchronization State Patternp. 598
12.3.7 Barrier State Patternp. 599
12.3.8 Event Hierarchy State Patternp. 602
12.3.9 Random State Patternp. 604
12.3.10 Null State Patternp. 605
12.3.11 Watchdog State Patternp. 607
12.3.12 Retriggerable Counter State Patternp. 610
12.4 Model-Level Debugging and Testingp. 611
12.4.1 Animated Debuggingp. 613
12.4.2 Animated Testingp. 614
12.4.3 Sample Debugging Sessionp. 617
12.5 Summaryp. 628
12.6 Looking Aheadp. 628
12.7 Exercisesp. 629
12.8 Referencesp. 629
Chapter 13 Real-Time Frameworksp. 631
13.1 Introductionp. 632
13.2 Terms and Conceptsp. 633
13.3 Real-Time Frameworksp. 636
13.3.1 Architectural Support Patternsp. 636
13.3.2 Collaboration and Distribution Patternsp. 640
13.3.3 Safety and Reliability Patternsp. 645
13.3.4 Behavioral Patternsp. 647
13.4 Framework Design Principles and Metricsp. 651
13.4.1 Set of Servicesp. 652
13.4.2 Generalization Hierarchy Structurep. 653
13.4.3 Replaceable Componentsp. 654
13.4.4 Portabilityp. 654
13.4.5 Naming and Syntax Conventionsp. 655
13.4.6 Performancep. 656
13.5 The Rhapsody Object Execution Framework (OXF)p. 657
13.5.1 Rhapsody Architecturep. 657
13.5.2 Execution Frameworkp. 660
13.5.3 Inter-Object Association Patternsp. 661
13.5.4 Using C++ Standard Template Libraryp. 664
13.5.5 Abstract Operating Systemp. 664
13.5.6 Animation Frameworkp. 666
13.6 Sample Application Using the Rhapsody OXF Frameworkp. 667
13.7 Summaryp. 680
13.8 Exercisesp. 681
13.9 Referencesp. 682
Appendix A Summary of UML Notationp. 683
Appendix B Rhapsody: A Fully Constructive UML Visual Programming Toolp. 701
Appendix C TimeWiz: An Integrated Tool for Timing Analysisp. 713
Indexp. 723
CD-ROM Warrantyp. 766