معرفی کتاب «Real-Time Design Patterns : robust scalable architecture for Real-time systems» نوشتهٔ Bruce Powell Douglass، منتشرشده توسط نشر Addison Wesley Professional Pearson Education [distributor در سال 2002. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Real-time and embedded systems developers face unique challenges. The systems they design must use very limited processor and memory resources optimally to meet mission-critical and high reliability requirements. Developers working on these systems see the same common threads in problems again and again. The very best developers abstract these problems and their solutions into generalized approaches that prove consistently effective: design patterns. In this book, real-time programming guru Bruce Powel Douglass collects the best design patterns from this unique, and rapidly growing, area of programming, and presents them in an instructional format that teaches the reader the ''what, when, and how'' of leveraging the significant power of these proven design solutions sample.pdf -1 sterling.com -1 Welcome to Sterling Software -1 Real-Time Design Patterns.pdf 1 Table of Content 2 Copyright 5 Dedication 6 Foreword 6 References 8 Preface 8 Goals 8 Audience 8 Organization 9 More Information 9 Acknowledgments 10 Part I: Design Pattern Basics 11 Chapter 1. Introduction 12 1.1 Basic Modeling Concepts of the UML 12 1.2 Models 13 1.3 Structural Elements and Diagrams 14 1.3.1 Small Things: Objects, Classes, and Interfaces 14 Figure 1-1. Basic Class Diagram 14 Code Listing 1: Class Diagram in Java 16 Code Listing 2: Class Diagram in C++ 17 1.3.2 Relations 18 1.3.2.1 Associations 18 Figure 1-2. Association, Aggregation, and Composition 18 1.3.2.2 Aggregation 20 1.3.2.3 Composition 20 1.3.2.4 Generalization 21 Figure 1-3. Polymorphism 22 Code Listing 1-3: MsgQueue::insert() operation 22 Code Listing 1-4: CachedQueue::insert() operation 23 Figure 1-4. Generalization 23 1.3.2.5 Dependency 24 Figure 1-5. Dependency 25 1.3.3 Structural Diagrams 26 1.3.4 Big Things: Subsystems, Components, and Packages 27 Figure 1-6. Packages 27 Figure 1-7. Subsystems 29 Figure 1-8. Components 30 Figure 1-9. System, Subsystem, Component, and Active Objects Organized by Size 31 1.4 Behavioral Elements and Diagrams 31 1.4.1 Actions and Activities 31 1.4.2 Operations and Methods 32 1.4.3 Statecharts 32 Figure 1-10. Simple Statechart 33 Figure 1-11. And-States 34 Figure 1-12. Pseudostates 35 1.4.4 Activity Charts 37 Figure 1-13. Activity Chart 38 1.4.5 Interactions 39 Figure 1-14. Collaboration Diagram 39 Figure 1-15. Sequence Diagram 40 Figure 1-16. Sequence Diagram 41 1.5 Use Case and Requirements Models 42 42 Figure 1-17. Use Cases 42 1.5.1 Capturing Black-Box Behavior Without Revealing Internal Structure 43 1.6 What Is a Design Pattern? 44 References 46 Chapter 2. Architecture and the UML 47 2.1 Architecture 47 48 Figure 2-1. ROPES and Architecture 48 2.2 Logical and Physical Architecture 48 48 Figure 2-2. Logical and Physical Architecture 48 2.2.1 Logical Architecture 50 Figure 2-3. Logical Domain Architecture 50 Figure 2-4. Domain Hierarchy 51 Figure 2-5. Relating Logical and Physical Architecture 52 2.2.2 Physical Architecture 53 Figure 2-6. Levels of Abstraction in Architecture 53 2.3 The Five Views of Architecture 55 55 Figure 2-7. The Five Views of Architecture 55 Figure 2-8. System View 56 2.3.1 Subsystem and Component View 57 Figure 2-9. Subsystem View 57 Figure 2-10. Component View 58 2.3.2 Concurrency and Resource View 59 Figure 2-11. Concurrency and Resource View 59 2.3.3 Distribution View 61 Figure 2-12. Distribution View 61 2.3.4 Safety and Reliability View 64 Figure 2-13. Safety and Reliability View 64 2.3.5 Deployment View 65 Figure 2-14. Deployment View 66 2.4 Implementing Architectures 67 2.4.1 Alphabet Soup: CORBA, UML, and MDA Basics 67 2.4.2 MDA to the Rescue 68 2.4.3 Creating Architectural Elements—the Model L 69 2.4.3.1 Basic Elements 69 Figure 2-15. Container Pattern 71 2.4.3.2 Logical Model 72 2.4.3.3 Physical Model 72 2.4.4 Subsystem and Component View 72 2.4.5 Concurrency and Resource View 72 2.4.6 Distribution View 73 2.4.7 Safety and Reliability View 73 2.4.8 Deployment View 73 References 73 Chapter 3. The Role of Design Patterns 75 3.1 Introduction 75 3.2 The ROPES Development Process 75 3.2.1 Why Process? 76 Figure 3-1. Basic Elements of Process 77 3.2.2 ROPES Process Overview 78 3.2.2.1 Key Enabling Technologies 78 Figure 3-2. Key Enabling Technologies 78 3.2.2.1.1 Visual Modeling 79 3.2.2.1.2 Model Execution 79 Figure 3-3. Visual Model Execution and Test 80 3.2.2.1.3 Model-Code Associativity 81 3.2.2.1.4 Automated Requirements-Based Testing 82 Figure 3-4. Incremental Development with Prototypes 83 3.2.2.1.5 Frameworks 84 3.2.2.1.6 Iterative Development 84 3.2.2.2 Process Timescales 84 Figure 3-5. ROPES Spiral Macrocycle 85 Figure 3-6. ROPES Microcycle (Overview) 86 Figure 3-7. ROPES Nanocycle 86 3.2.2.2.1 Semispiral Lifecycle Model 87 Figure 3-8. ROPES Semispiral Lifecycle 87 3.2.3 The ROPES Microcycle in Detail 89 Figure 3-9. ROPES Spiral Microcycle (Detail) 89 3.2.4 Party! 89 3.2.5 Analysis with the ROPES Process 90 3.2.5.1 Requirements Analysis Phase 90 3.2.5.2 Systems Engineering Phase 91 3.2.5.3 Object Analysis Phase 92 3.2.6 Design with the ROPES Process 92 3.2.6.1 Architectural Design Phase 93 3.2.6.2 Mechanistic Design Phase 93 3.2.6.3 Detailed Design Phase 93 3.2.7 Translation 94 3.2.8 Test 94 3.3 Design Pattern Basics 95 3.3.1 What Is a Design Pattern? 95 3.3.2 Basic Structure of Design Patterns 97 3.3.3 How to Read Design Patterns in this Book 98 3.4 Using Design Patterns in Development 99 3.4.1 Pattern Hatching—Locating the Right Pattern 99 Figure 3-10. Pattern Hatching 99 3.4.2 Pattern Mining—Rolling Your Own Patterns 100 Figure 3-11. Pattern Mining 100 3.4.3 Pattern Instantiation—Applying Patterns in 101 Figure 3-12. Pattern Instantiation 101 References 102 Part II: Architectural Design Patterns 103 References 104 Chapter 4. Subsystem and Component Architecture Patterns 105 4.1 Layered Pattern 105 4.1.1 Abstract 105 Figure 4-1. Cardiology Conceptual Hierarchy 106 4.1.2 Problem 106 4.1.3 Pattern Structure 106 Figure 4-2. Layered Pattern Structure 107 4.1.4 Collaboration Roles 107 4.1.5 Consequences 107 4.1.6 Implementation Strategies 107 4.1.7 Related Patterns 108 4.1.8 Sample Model 108 Figure 4-3. ECG Domain Model 108 Figure 4-4. ECG Collaboration 108 4.2 Five-Layer Architecture Pattern 109 4.2.1 Abstract 109 4.2.2 Problem 109 4.2.3 Pattern Structure 109 Figure 4-5. Five-Layer Architecture Pattern Structure 109 4.2.4 Collaboration Roles 110 4.2.5 Consequences 111 4.2.6 Implementation Strategies 111 4.2.7 Related Patterns 111 4.2.8 Sample Model 111 Figure 4-6. Ventilator Example Domains 111 4.3 Microkernel Architecture Pattern 112 4.3.1 Abstract 112 4.3.2 Problem 112 4.3.3 Pattern Structure 112 Figure 4-7. Microkernel Architecture Pattern Structure 113 4.3.4 Collaboration Roles 113 4.3.5 Consequences 114 4.3.6 Implementation Strategies 114 4.3.7 Related Patterns 115 4.3.8 Sample Model 115 Figure 4-8. nanoOS Model 115 4.4 Channel Architecture Pattern 116 4.4.1 Abstract 116 4.4.2 Problem 116 4.4.3 Pattern Structure 116 Figure 4-9. Channel Architecture Pattern Structure 116 4.4.4 Collaboration Roles 117 4.4.5 Consequences 118 4.4.6 Implementation Strategies 118 4.4.7 Related Patterns 118 4.4.8 Sample Model 119 Figure 4-10. ECG Monitor Channel Pattern Example 119 4.5 Recursive Containment Pattern 120 4.5.1 Abstract 120 4.5.2 Problem 120 4.5.3 Pattern Structure 120 Figure 4-11. Recursive Containment Pattern Structure 120 4.5.4 Collaboration Roles 121 4.5.5 Consequences 121 4.5.6 Implementation Strategies 121 4.5.7 Related Patterns 122 4.5.8 Sample Model 122 Figure 4-12. High Level Use Case 122 Figure 4-13. Spacecraft Subsystem Model 122 Figure 4-14. Decomposed Use Cases 123 Figure 4-15. Mapping Decomposed Use Cases to Subsystems 123 Figure 4-16. Spacecraft Subsystem Details 124 4.6 Hierarchical Control Pattern 125 4.6.1 Abstract 125 4.6.2 Problem 125 4.6.3 Pattern Structure 125 Figure 4-17. Hierarchical Control Pattern Structure 125 4.6.4 Collaboration Roles 126 4.6.5 Consequences 126 4.6.6 Implementation Strategies 127 4.6.7 Related Patterns 127 4.6.8 Sample Model 127 Figure 4-18. Hierarchical Control Pattern Structure 128 4.7 Virtual Machine Pattern 128 4.7.1 Abstract 128 4.7.2 Problem 129 4.7.3 Pattern Structure 129 Figure 4-19. Virtual Machine Pattern Structure 129 4.7.4 Collaboration Roles 130 4.7.5 Consequences 131 4.7.6 Implementation Strategies 131 4.7.6.1 Reusability of the Virtual Machine 131 4.7.6.2 Interacting with the Underlying Platform 132 4.7.6.3 Representing the Application 133 4.7.6.4 Scheduling Applications 133 4.7.6.5 Debugging the Testing Facilities 133 4.7.7 Related Patterns 134 4.8 Component-Based Architecture 134 4.8.1 Abstract 134 4.8.2 Problem 135 4.8.3 Pattern Structure 135 Figure 4-20. Component-Based Architecture Pattern Structure 135 4.8.4 Collaboration Roles 135 4.8.5 Consequences 136 4.8.6 Implementation Strategies 137 4.8.7 Related Patterns 138 4.8.8 Sample Model 138 Figure 4-21. Control System Sample Model 138 Figure 4-22. Initialization of Display Objects Sequence Diagram 139 4.9 ROOM Pattern 140 4.9.1 Abstract 141 4.9.2 Problem 141 4.9.3 Pattern Structure 141 Figure 4-23. ROOM Pattern Structure 141 4.9.4 Collaboration Roles 142 4.9.5 Consequences 142 4.9.6 Implementation Strategies 143 4.9.7 Related Patterns 143 4.9.8 Sample Model 143 Figure 4-24. ROOM Pattern Example Class Model 144 Figure 4-25. ROOM Pattern Example Statechart Model 144 References 146 Chapter 5. Concurrency Patterns 147 5.1 Introduction 147 5.2 Concurrency Pattern 147 147 Figure 5-1. Using ?active? Objects 147 5.3 Message Queuing Pattern 149 149 Figure 5-2. The Mutual Exclusion Problem 149 5.3.1 Abstract 150 5.3.2 Problem 150 5.3.3 Pattern Structure 150 Figure 5-3. Message Queuing Pattern 150 5.3.4 Collaboration Roles 151 5.3.5 Consequences 151 5.3.6 Implementation Strategies 152 5.3.7 Related Patterns 152 5.3.8 Sample Model 152 Figure 5-4. Message Queuing Pattern Example 152 5.4 Interrupt Pattern 153 5.4.1 Abstract 154 5.4.2 Problem 154 5.4.3 Pattern Structure 154 Figure 5-5. Interrupt Pattern 154 Figure 5-6. Interrupt Handling Methods 154 5.4.4 Collaboration Roles 155 5.4.5 Consequences 156 5.4.6 Implementation Strategies 156 5.4.7 Related Patterns 157 5.4.8 Sample Model 157 Figure 5-7. Interrupt Pattern Example 157 5.5 Guarded Call Pattern 158 158 Figure 5-8. Guarded Call Pattern 158 5.5.1 Abstract 159 5.5.2 Problem 159 5.5.3 Pattern Structure 159 5.5.4 Collaboration Roles 159 5.5.5 Consequences 160 5.5.6 Implementation Strategies 160 5.5.7 Related Patterns 161 5.5.8 Sample Model 161 Figure 5-9. Guarded Call Pattern Example 161 5.6 Rendezvous Pattern 163 163 Figure 5-10. Rendezvous Pattern 163 5.6.1 Abstract 163 5.6.2 Problem 163 5.6.3 Pattern Structure 163 5.6.4 Collaboration Roles 164 5.6.5 Consequences 164 5.6.6 Implementation Strategies 164 Figure 5-11. Thread Barrier Synch Policy Statechart 164 5.6.7 Related Patterns 165 5.6.8 Sample Model 165 Figure 5-12. Rendezvous Pattern Example 165 5.7 Cyclic Executive Pattern 166 5.7.1 Abstract 166 5.7.2 Problem 166 5.7.3 Pattern Structure 167 Figure 5-13. Cyclic Executive Pattern 167 5.7.4 Collaboration Roles 167 5.7.5 Consequences 168 5.7.6 Implementation Strategies 168 5.7.7 Related Patterns 168 Figure 5-14. Cyclic Executive Pattern Example 169 5.8 Round Robin Pattern 169 5.8.1 Abstract 169 5.8.2 Problem 170 5.8.3 Pattern Structure 170 Figure 5-15. Round Robin Pattern 170 5.8.4 Collaboration Roles 170 5.8.5 Consequences 171 5.8.6 Implementation Strategies 171 5.8.7 Related Patterns 172 5.8.8 Sample Model 172 Figure 5-16. Round Robin Pattern Example 172 5.9 Static Priority Pattern 173 5.9.1 Abstract 173 5.9.2 Problem 174 5.9.3 Pattern Structure 174 Figure 5-17. Static Priority Pattern 174 5.9.4 Collaboration Roles 175 5.9.5 Consequences 177 5.9.6 Implementation Strategies 177 5.9.7 Related Patterns 178 5.9.8 Sample Model 178 Figure 5-18. Static Priority Pattern Example 178 5.10 Dynamic Priority Pattern 180 5.10.1 Abstract 180 5.10.2 Problem 180 5.10.3 Pattern Structure 180 Figure 5-19. Dynamic Priority Pattern 180 5.10.4 Collaboration Roles 181 5.10.5 Consequences 182 5.10.6 Implementation Strategies 183 5.10.7 Related Patterns 183 5.10.8 Sample Model 183 Figure 5-20. Dynamic Priority Pattern Example 183 References 184 Chapter 6. Memory Patterns 186 6.1 Memory Management Patterns 186 6.2 Static Allocation Pattern 186 6.2.1 Abstract 186 6.2.2 Problem 186 6.2.3 Pattern Structure 187 Figure 6-1. Static Allocation Pattern 187 6.2.4 Collaboration Roles 188 6.2.5 Consequences 188 6.2.6 Implementation Strategies 189 6.2.7 Related Patterns 189 6.2.8 Sample Model 189 Figure 6-2. Static Allocation Pattern Example 189 6.3 Pool Allocation Pattern 190 6.3.1 Abstract 190 6.3.2 Problem 191 6.3.3 Pattern Structure 191 Figure 6-3. Pooled Allocation Pattern 191 6.3.4 Collaboration Roles 191 6.3.5 Consequences 192 6.3.6 Implementation Strategies 192 Code Segment 6-1: C++ Pooled Allocation Implementation Strategy 192 Code Segment 6-2: Java Implementation Strategy for Pools 193 6.3.7 Related Patterns 194 6.3.8 Sample Model 194 Figure 6-4. Pooled Allocation Pattern Example 194 6.4 Fixed Sized Buffer Pattern 195 6.4.1 Abstract 196 6.4.2 Problem 196 6.4.3 Pattern Structure 196 Figure 6-5. Fixed Sized Buffer Pattern 196 6.4.4 Collaboration Roles 197 6.4.5 Consequences 198 6.4.6 Implementation Strategies 198 6.4.7 Related Patterns 198 6.4.8 Sample Model 198 Figure 6-6. Fixed Sized Buffer Pattern Example 198 6.5 Smart Pointer Pattern 199 6.5.1 Abstract 199 6.5.2 Problem 200 6.5.3 Pattern Structure 200 Figure 6-7. Smart Pointer Pattern 200 6.5.4 Collaboration Roles 201 6.5.5 Consequences 202 Figure 6-8. Smart Pointer Cycles 202 6.5.6 Implementation Strategies 203 6.5.7 Related Patterns 203 6.5.8 Sample Model 203 Figure 6-9. Smart Pointer Pattern Example 203 6.6 Garbage Collection Pattern 204 6.6.1 Abstract 204 6.6.2 Problem 205 6.6.3 Pattern Structure 205 Figure 6-10. Garbage Collection Pattern (Mark and Sweep) 205 6.6.4 Collaboration Roles 205 6.6.5 Consequences 206 6.6.6 Implementation Strategies 207 6.6.7 Related Patterns 207 6.6.8 Sample Model 207 Figure 6-11. Garbage Collection Pattern 207 Figure 6-12. Garbage Collection Pattern Example Scenario 208 6.7 Garbage Compactor Pattern 209 6.7.1 Abstract 209 6.7.2 Problem 209 6.7.3 Pattern Structure 209 Figure 6-13. Garbage Compactor Pattern 210 6.7.4 Collaboration Roles 210 6.7.5 Consequences 211 6.7.6 Implementation Strategies 212 6.7.7 Related Patterns 212 6.7.8 Sample Model 212 Figure 6-14. Garbage Compactor Pattern 212 Figure 6-15. Garbage Compactor Pattern Example Scenario 213 References 214 Chapter 7. Resource Patterns 215 7.1 Introduction 215 216 Figure 7-1. Task Blocking [1] 216 Figure 7-2. Unbounded Task Blocking 217 Figure 7-3. Deadlock 219 7.2 Critical Section Pattern 220 7.2.1 Abstract 220 7.2.2 Problem 220 7.2.3 Pattern Structure 220 Figure 7-4. Critical Section Pattern 220 7.2.4 Collaboration Roles 221 7.2.5 Consequences 222 7.2.6 Implementation Strategies 222 7.2.7 Related Patterns 222 7.2.8 Sample Model 222 Figure 7-5. Critical Section Pattern Example 222 7.3 Priority Inheritance Pattern 224 7.3.1 Abstract 224 7.3.2 Problem 224 7.3.3 Pattern Structure 224 Figure 7-6. Priority Inheritance Pattern 224 7.3.4 Collaboration Roles 224 7.3.5 Consequences 226 Figure 7-7. Priority Inheritance Pattern 226 Figure 7-8. Priority Inheritance Pattern 226 7.3.6 Implementation Strategies 228 7.3.7 Related Patterns 228 7.3.8 Sample Model 228 Figure 7-9. Priority Inheritance Pattern 228 7.4 Highest Locker Pattern 230 7.4.1 Abstract 230 7.4.2 Problem 230 7.4.3 Pattern Structure 230 Figure 7-10. Highest Locker Pattern 230 7.4.4 Collaboration Roles 231 7.4.5 Consequences 232 7.4.6 Implementation Strategies 233 7.4.7 Related Patterns 233 7.4.8 Sample Model 233 Figure 7-11. Highest Locker Pattern 233 7.5 Priority Ceiling Pattern 235 7.5.1 Abstract 235 7.5.2 Problem 235 7.5.3 Pattern Structure 235 Figure 7-12. Priority Ceiling Pattern 235 Figure 7-13. Priority Ceiling Pattern Resource Algorithm 236 7.5.4 Collaboration Roles 237 7.5.5 Consequences 239 7.5.6 Implementation Strategies 239 7.5.7 Related Patterns 239 7.5.8 Sample Model 239 Figure 7-14. Priority Ceiling Pattern 239 7.6 Simultaneous Locking Pattern 241 7.6.1 Abstract 241 7.6.2 Problem 241 7.6.3 Pattern Structure 241 Figure 7-15. Simultaneous Locking Pattern 241 7.6.4 Collaboration Roles 242 7.6.5 Consequences 243 7.6.6 Implementation Strategies 244 7.6.7 Related Patterns 244 7.6.8 Sample Model 244 Figure 7-16. Simultaneous Locking Pattern 244 7.7 Ordered Locking Pattern 246 7.7.1 Abstract 246 7.7.2 Problem 246 7.7.3 Pattern Structure 246 Figure 7-17. Ordered Locking Pattern 246 7.7.4 Collaboration Roles 247 7.7.5 Consequences 248 7.7.6 Implementation Strategies 248 7.7.7 Related Patterns 249 7.7.8 Sample Model 249 Figure 7-18. Ordered Locking Pattern 249 References 251 Chapter 8. Distribution Patterns 252 8.1 Introduction 252 8.2 Shared Memory Pattern 253 8.2.1 Abstract 253 8.2.2 Problem 254 8.2.3 Pattern Structure 254 Figure 8-1. Shared Memory Pattern 254 8.2.4 Collaboration Roles 254 8.2.5 Consequences 256 8.2.6 Implementation Strategies 256 8.2.7 Related Patterns 256 8.2.8 Sample Model 256 Figure 8-2. Shared Memory Pattern 256 8.3 Remote Method Call Pattern 258 8.3.1 Abstract 258 8.3.2 Problem 258 8.3.3 Pattern Structure 258 Figure 8-3. Remote Method Call Pattern 258 8.3.4 Collaboration Roles 259 8.3.5 Consequences 260 8.3.6 Implementation Strategies 260 8.3.7 Related Patterns 261 8.3.8 Sample Model 261 Figure 8-4. Remote Method Call Example 262 Figure 8-5. Remote Method Call Scenario 262 8.4 Observer Pattern 263 8.4.1 Abstract 263 8.4.2 Problem 264 8.4.3 Pattern Structure 264 Figure 8-6. Observer Pattern 264 8.4.4 Collaboration Roles 265 8.4.5 Consequences 266 8.4.6 Implementation Strategies 266 8.4.7 Related Patterns 267 8.4.8 Sample Model 267 Figure 8-7. Observer Pattern Example 267 8.5 Data Bus Pattern 268 8.5.1 Abstract 269 8.5.2 Problem 269 8.5.3 Pattern Structure 269 Figure 8-8. Data Bus Pattern (Pull Version) 269 Figure 8-9. Data Bus Pattern (Push Version) 270 8.5.4 Collaboration Roles 271 8.5.5 Consequences 274 8.5.6 Implementation Strategies 274 8.5.7 Related Patterns 274 8.5.8 Sample Model 275 Figure 8-10. Data Bus Pattern Example Structure 275 Figure 8-11. Data Bus Pattern Example Scenario 276 8.6 Proxy Pattern 277 8.6.1 Abstract 278 8.6.2 Problem 278 8.6.3 Pattern Structure 278 Figure 8-12. Proxy Pattern 278 8.6.4 Collaboration Roles 279 8.6.5 Consequences 280 8.6.6 Implementation Strategies 280 8.6.7 Related Patterns 281 8.6.8 Sample Model 281 Figure 8-13. Proxy Pattern Example Structure 281 Figure 8-14. Proxy Pattern Example Scenario 282 8.7 Broker Pattern 284 8.7.1 Abstract 284 8.7.2 Problem 284 8.7.3 Pattern Structure 284 Figure 8-15. Broker Pattern 284 8.7.4 Collaboration Roles 285 8.7.5 Consequences 287 8.7.6 Implementation Strategies 287 Figure 8-16. Simple CORBA Example Model 288 8.7.7 Related Patterns 288 8.7.8 Sample Model 288 Figure 8-17. Broker Pattern 288 References 289 Chapter 9. Safety and Reliability Patterns 291 9.1 Introduction 291 292 Figure 9-1. Safety Versus Reliability 292 9.1.1 Handling Faults 292 9.2 Protected Single Channel Pattern 293 9.2.1 Abstract 293 9.2.2 Problem 294 9.2.3 Pattern Structure 294 Figure 9-2. Protected Single Channel Pattern 294 9.2.4 Collaboration Roles 294 9.2.5 Consequences 295 9.2.6 Implementation Strategies 296 9.2.7 Related Patterns 296 9.2.8 Sample Model 296 Figure 9-3. Protected Single Channel Pattern Example 296 9.3 Homogeneous Redundancy Pattern 297 9.3.1 Abstract 297 9.3.2 Problem 298 9.3.3 Pattern Structure 298 Figure 9-4. Homogeneous Redundancy Pattern 298 9.3.4 Collaboration Roles 298 9.3.5 Consequences 300 9.3.6 Implementation Strategies 300 9.3.7 Related Patterns 300 9.3.8 Sample Model 300 Figure 9-5. Homogeneous Redundancy Pattern Example 300 9.4 Triple Modular Redundancy Pattern 301 9.4.1 Abstract 301 9.4.2 Problem 302 9.4.3 Pattern Structure 302 Figure 9-6. Triple Modular Redundancy Pattern 302 9.4.4 Collaboration Roles 302 9.4.5 Consequences 303 9.4.6 Implementation Strategies 303 9.4.7 Related Patterns 304 9.4.8 Sample Model 304 Figure 9-7. Triple Modular Redundancy Example 304 9.5 Heterogeneous Redundancy Pattern 305 9.5.1 Abstract 305 9.5.2 Problem 305 9.5.3 Pattern Structure 306 Figure 9-8. Heterogeneous Redundancy Pattern 306 9.5.4 Collaboration Roles 306 9.5.5 Consequences 307 9.5.6 Implementation Strategies 307 9.5.7 Related Patterns 308 9.5.8 Sample Model 308 Figure 9-9. Heterogeneous Redundancy Pattern Example 308 9.6 Monitor-Actuator Pattern 309 9.6.1 Abstract 309 9.6.2 Problem 309 9.6.3 Pattern Structure 309 Figure 9-10. Monitor-Actuator Pattern 309 9.6.4 Collaboration Roles 309 9.6.5 Consequences 311 9.6.6 Implementation Strategies 311 9.6.7 Related Patterns 312 9.6.8 Sample Model 312 Figure 9-11. Monitor-Actuator Example 312 9.7 Sanity Check Pattern 313 9.7.1 Abstract 313 9.7.2 Problem 313 9.7.3 Pattern Structure 313 Figure 9-12. Sanity Check Pattern 313 9.7.4 Collaboration Roles 314 9.7.5 Consequences 315 9.7.6 Implementation Strategies 315 9.7.7 Related Patterns 315 9.7.8 Sample Model 315 Figure 9-13. Sanity Check Pattern Example 316 9.8 Watchdog Pattern 316 9.8.1 Abstract 316 9.8.2 Problem 316 9.8.3 Pattern Structure 317 Figure 9-14. Watchdog Pattern 317 Figure 9-15. Watchdog State Machine 317 9.8.4 Collaboration Roles 318 9.8.5 Consequences 319 9.8.6 Implementation Strategies 319 9.8.7 Related Patterns 320 9.8.8 Sample Model 320 Figure 9-16. Watchdog Pattern Example 320 9.9 Safety Executive Pattern 321 9.9.1 Abstract 321 9.9.2 Problem 321 9.9.3 Pattern Structure 321 Figure 9-17. Safety Executive Pattern 321 9.9.4 Collaboration Roles 322 9.9.5 Consequences 324 9.9.6 Implementation Strategies 324 9.9.7 Related Patterns 324 9.9.8 Sample Model 324 Figure 9-18. Safety Executive Pattern Example 324 References 325 Appendix A. Notational Summary 327 Class Diagram 327 Class 327 Visibility 327 Parameterized Class 327 Object 328 Association 328 Aggregation and Composition 328 Advanced Associations 329 Generalization and Specialization 329 Notes and Constraints 330 Stereotypes and Classifiers 330 Collaboration Diagram 331 Object Collaboration 331 Message Syntax 331 Sequence Diagram 332 Advanced Sequence Diagrams 332 Use Cases 333 Use Case Diagram 333 Use Case Relationships 333 Implementation Diagrams 334 Component diagram 334 Deployment Diagram 334 Package diagram 335 Statechart 336 State icon 336 Transitions 337 Nested States 337 Sequential substates 337 Orthogonal Substates (and-states) 338 Pseudostates 338 Synch Pseudostates 339 Submachines 339 Activity Diagrams 340 Appendix B. Pattern Index 342 Real-Time Design Patterns.pdf......Page 0 Table of Content......Page 2 Copyright......Page 5 Foreword......Page 6 Audience......Page 8 More Information......Page 9 Acknowledgments......Page 10 Part I: Design Pattern Basics......Page 11 1.1 Basic Modeling Concepts of the UML......Page 12 1.2 Models......Page 13 Figure 1-1. Basic Class Diagram......Page 14 Code Listing 1: Class Diagram in Java......Page 16 Code Listing 2: Class Diagram in C++......Page 17 Figure 1-2. Association, Aggregation, and Composition......Page 18 1.3.2.3 Composition......Page 20 1.3.2.4 Generalization......Page 21 Code Listing 1-3: MsgQueue::insert() operation......Page 22 Figure 1-4. Generalization......Page 23 1.3.2.5 Dependency......Page 24 Figure 1-5. Dependency......Page 25 1.3.3 Structural Diagrams......Page 26 Figure 1-6. Packages......Page 27 Figure 1-7. Subsystems......Page 29 Figure 1-8. Components......Page 30 1.4.1 Actions and Activities......Page 31 1.4.3 Statecharts......Page 32 Figure 1-10. Simple Statechart......Page 33 Figure 1-11. And-States......Page 34 Figure 1-12. Pseudostates......Page 35 1.4.4 Activity Charts......Page 37 Figure 1-13. Activity Chart......Page 38 Figure 1-14. Collaboration Diagram......Page 39 Figure 1-15. Sequence Diagram......Page 40 Figure 1-16. Sequence Diagram......Page 41 Figure 1-17. Use Cases......Page 42 1.5.1 Capturing Black-Box Behavior Without Revealing Internal Structure......Page 43 1.6 What Is a Design Pattern?......Page 44 References......Page 46 2.1 Architecture......Page 47 Figure 2-2. Logical and Physical Architecture......Page 48 Figure 2-3. Logical Domain Architecture......Page 50 Figure 2-4. Domain Hierarchy......Page 51 Figure 2-5. Relating Logical and Physical Architecture......Page 52 Figure 2-6. Levels of Abstraction in Architecture......Page 53 Figure 2-7. The Five Views of Architecture......Page 55 Figure 2-8. System View......Page 56 Figure 2-9. Subsystem View......Page 57 Figure 2-10. Component View......Page 58 Figure 2-11. Concurrency and Resource View......Page 59 Figure 2-12. Distribution View......Page 61 Figure 2-13. Safety and Reliability View......Page 64 2.3.5 Deployment View......Page 65 Figure 2-14. Deployment View......Page 66 2.4.1 Alphabet Soup: CORBA, UML, and MDA Basics......Page 67 2.4.2 MDA to the Rescue......Page 68 2.4.3.1 Basic Elements......Page 69 Figure 2-15. Container Pattern......Page 71 2.4.5 Concurrency and Resource View......Page 72 References......Page 73 3.2 The ROPES Development Process......Page 75 3.2.1 Why Process?......Page 76 Figure 3-1. Basic Elements of Process......Page 77 Figure 3-2. Key Enabling Technologies......Page 78 3.2.2.1.2 Model Execution......Page 79 Figure 3-3. Visual Model Execution and Test......Page 80 3.2.2.1.3 Model-Code Associativity......Page 81 3.2.2.1.4 Automated Requirements-Based Testing......Page 82 Figure 3-4. Incremental Development with Prototypes......Page 83 3.2.2.2 Process Timescales......Page 84 Figure 3-5. ROPES Spiral Macrocycle......Page 85 Figure 3-7. ROPES Nanocycle......Page 86 Figure 3-8. ROPES Semispiral Lifecycle......Page 87 3.2.4 Party!......Page 89 3.2.5.1 Requirements Analysis Phase......Page 90 3.2.5.2 Systems Engineering Phase......Page 91 3.2.6 Design with the ROPES Process......Page 92 3.2.6.3 Detailed Design Phase......Page 93 3.2.8 Test......Page 94 3.3.1 What Is a Design Pattern?......Page 95 3.3.2 Basic Structure of Design Patterns......Page 97 3.3.3 How to Read Design Patterns in this Book......Page 98 Figure 3-10. Pattern Hatching......Page 99 Figure 3-11. Pattern Mining......Page 100 Figure 3-12. Pattern Instantiation......Page 101 References......Page 102 Part II: Architectural Design Patterns......Page 103 References......Page 104 4.1.1 Abstract......Page 105 4.1.3 Pattern Structure......Page 106 4.1.6 Implementation Strategies......Page 107 Figure 4-4. ECG Collaboration......Page 108 Figure 4-5. Five-Layer Architecture Pattern Structure......Page 109 4.2.4 Collaboration Roles......Page 110 Figure 4-6. Ventilator Example Domains......Page 111 4.3.3 Pattern Structure......Page 112 4.3.4 Collaboration Roles......Page 113 4.3.6 Implementation Strategies......Page 114 Figure 4-8. nanoOS Model......Page 115 Figure 4-9. Channel Architecture Pattern Structure......Page 116 4.4.4 Collaboration Roles......Page 117 4.4.7 Related Patterns......Page 118 Figure 4-10. ECG Monitor Channel Pattern Example......Page 119 Figure 4-11. Recursive Containment Pattern Structure......Page 120 4.5.6 Implementation Strategies......Page 121 Figure 4-13. Spacecraft Subsystem Model......Page 122 Figure 4-15. Mapping Decomposed Use Cases to Subsystems......Page 123 Figure 4-16. Spacecraft Subsystem Details......Page 124 Figure 4-17. Hierarchical Control Pattern Structure......Page 125 4.6.5 Consequences......Page 126 4.6.8 Sample Model......Page 127 4.7.1 Abstract......Page 128 Figure 4-19. Virtual Machine Pattern Structure......Page 129 4.7.4 Collaboration Roles......Page 130 4.7.6.1 Reusability of the Virtual Machine......Page 131 4.7.6.2 Interacting with the Underlying Platform......Page 132 4.7.6.5 Debugging the Testing Facilities......Page 133 4.8.1 Abstract......Page 134 4.8.4 Collaboration Roles......Page 135 4.8.5 Consequences......Page 136 4.8.6 Implementation Strategies......Page 137 Figure 4-21. Control System Sample Model......Page 138 Figure 4-22. Initialization of Display Objects Sequence Diagram......Page 139 4.9 ROOM Pattern......Page 140 Figure 4-23. ROOM Pattern Structure......Page 141 4.9.5 Consequences......Page 142 4.9.8 Sample Model......Page 143 Figure 4-25. ROOM Pattern Example Statechart Model......Page 144 References......Page 146 Figure 5-1. Using ?active? Objects......Page 147 Figure 5-2. The Mutual Exclusion Problem......Page 149 Figure 5-3. Message Queuing Pattern......Page 150 5.3.5 Consequences......Page 151 Figure 5-4. Message Queuing Pattern Example......Page 152 5.4 Interrupt Pattern......Page 153 Figure 5-6. Interrupt Handling Methods......Page 154 5.4.4 Collaboration Roles......Page 155 5.4.6 Implementation Strategies......Page 156 Figure 5-7. Interrupt Pattern Example......Page 157 Figure 5-8. Guarded Call Pattern......Page 158 5.5.4 Collaboration Roles......Page 159 5.5.6 Implementation Strategies......Page 160 Figure 5-9. Guarded Call Pattern Example......Page 161 5.6.3 Pattern Structure......Page 163 Figure 5-11. Thread Barrier Synch Policy Statechart......Page 164 Figure 5-12. Rendezvous Pattern Example......Page 165 5.7.2 Problem......Page 166 5.7.4 Collaboration Roles......Page 167 5.7.7 Related Patterns......Page 168 5.8.1 Abstract......Page 169 5.8.4 Collaboration Roles......Page 170 5.8.6 Implementation Strategies......Page 171 Figure 5-16. Round Robin Pattern Example......Page 172 5.9.1 Abstract......Page 173 Figure 5-17. Static Priority Pattern......Page 174 5.9.4 Collaboration Roles......Page 175 5.9.6 Implementation Strategies......Page 177 Figure 5-18. Static Priority Pattern Example......Page 178 Figure 5-19. Dynamic Priority Pattern......Page 180 5.10.4 Collaboration Roles......Page 181 5.10.5 Consequences......Page 182 Figure 5-20. Dynamic Priority Pattern Example......Page 183 References......Page 184 6.2.2 Problem......Page 186 Figure 6-1. Static Allocation Pattern......Page 187 6.2.5 Consequences......Page 188 Figure 6-2. Static Allocation Pattern Example......Page 189 6.3.1 Abstract......Page 190 6.3.4 Collaboration Roles......Page 191 Code Segment 6-1: C++ Pooled Allocation Implementation Strategy......Page 192 Code Segment 6-2: Java Implementation Strategy for Pools......Page 193 Figure 6-4. Pooled Allocation Pattern Example......Page 194 6.4 Fixed Sized Buffer Pattern......Page 195 Figure 6-5. Fixed Sized Buffer Pattern......Page 196 6.4.4 Collaboration Roles......Page 197 Figure 6-6. Fixed Sized Buffer Pattern Example......Page 198 6.5.1 Abstract......Page 199 Figure 6-7. Smart Pointer Pattern......Page 200 6.5.4 Collaboration Roles......Page 201 Figure 6-8. Smart Pointer Cycles......Page 202 Figure 6-9. Smart Pointer Pattern Example......Page 203 6.6.1 Abstract......Page 204 6.6.4 Collaboration Roles......Page 205 6.6.5 Consequences......Page 206 Figure 6-11. Garbage Collection Pattern......Page 207 Figure 6-12. Garbage Collection Pattern Example Scenario......Page 208 6.7.3 Pattern Structure......Page 209 6.7.4 Collaboration Roles......Page 210 6.7.5 Consequences......Page 211 Figure 6-14. Garbage Compactor Pattern......Page 212 Figure 6-15. Garbage Compactor Pattern Example Scenario......Page 213 References......Page 214 7.1 Introduction......Page 215 Figure 7-1. Task Blocking [1]......Page 216 Figure 7-2. Unbounded Task Blocking......Page 217 Figure 7-3. Deadlock......Page 219 Figure 7-4. Critical Section Pattern......Page 220 7.2.4 Collaboration Roles......Page 221 Figure 7-5. Critical Section Pattern Example......Page 222 7.3.4 Collaboration Roles......Page 224 Figure 7-8. Priority Inheritance Pattern......Page 226 Figure 7-9. Priority Inheritance Pattern......Page 228 Figure 7-10. Highest Locker Pattern......Page 230 7.4.4 Collaboration Roles......Page 231 7.4.5 Consequences......Page 232 Figure 7-11. Highest Locker Pattern......Page 233 Figure 7-12. Priority Ceiling Pattern......Page 235 Figure 7-13. Priority Ceiling Pattern Resource Algorithm......Page 236 7.5.4 Collaboration Roles......Page 237 Figure 7-14. Priority Ceiling Pattern......Page 239 Figure 7-15. Simultaneous Locking Pattern......Page 241 7.6.4 Collaboration Roles......Page 242 7.6.5 Consequences......Page 243 Figure 7-16. Simultaneous Locking Pattern......Page 244 Figure 7-17. Ordered Locking Pattern......Page 246 7.7.4 Collaboration Roles......Page 247 7.7.6 Implementation Strategies......Page 248 Figure 7-18. Ordered Locking Pattern......Page 249 References......Page 251 8.1 Introduction......Page 252 8.2.1 Abstract......Page 253 8.2.4 Collaboration Roles......Page 254 Figure 8-2. Shared Memory Pattern......Page 256 Figure 8-3. Remote Method Call Pattern......Page 258 8.3.4 Collaboration Roles......Page 259 8.3.6 Implementation Strategies......Page 260 8.3.8 Sample Model......Page 261 Figure 8-5. Remote Method Call Scenario......Page 262 8.4.1 Abstract......Page 263 Figure 8-6. Observer Pattern......Page 264 8.4.4 Collaboration Roles......Page 265 8.4.6 Implementation Strategies......Page 266 Figure 8-7. Observer Pattern Example......Page 267 8.5 Data Bus Pattern......Page 268 Figure 8-8. Data Bus Pattern (Pull Version)......Page 269 Figure 8-9. Data Bus Pattern (Push Version)......Page 270 8.5.4 Collaboration Roles......Page 271 8.5.7 Related Patterns......Page 274 Figure 8-10. Data Bus Pattern Example Structure......Page 275 Figure 8-11. Data Bus Pattern Example Scenario......Page 276 8.6 Proxy Pattern......Page 277 Figure 8-12. Proxy Pattern......Page 278 8.6.4 Collaboration Roles......Page 279 8.6.6 Implementation Strategies......Page 280 Figure 8-13. Proxy Pattern Example Structure......Page 281 Figure 8-14. Proxy Pattern Example Scenario......Page 282 Figure 8-15. Broker Pattern......Page 284 8.7.4 Collaboration Roles......Page 285 8.7.6 Implementation Strategies......Page 287 Figure 8-17. Broker Pattern......Page 288 References......Page 289 9.1 Introduction......Page 291 9.1.1 Handling Faults......Page 292 9.2.1 Abstract......Page 293 9.2.4 Collaboration Roles......Page 294 9.2.5 Consequences......Page 295 Figure 9-3. Protected Single Channel Pattern Example......Page 296 9.3.1 Abstract......Page 297 9.3.4 Collaboration Roles......Page 298 Figure 9-5. Homogeneous Redundancy Pattern Example......Page 300 9.4.1 Abstract......Page 301 9.4.4 Collaboration Roles......Page 302 9.4.6 Implementation Strategies......Page 303 Figure 9-7. Triple Modular Redundancy Example......Page 304 9.5.2 Problem......Page 305 9.5.4 Collaboration Roles......Page 306 9.5.6 Implementation Strategies......Page 307 Figure 9-9. Heterogeneous Redundancy Pattern Example......Page 308 9.6.4 Collaboration Roles......Page 309 9.6.6 Implementation Strategies......Page 311 Figure 9-11. Monitor-Actuator Example......Page 312 Figure 9-12. Sanity Check Pattern......Page 313 9.7.4 Collaboration Roles......Page 314 9.7.8 Sample Model......Page 315 9.8.2 Problem......Page 316 Figure 9-15. Watchdog State Machine......Page 317 9.8.4 Collaboration Roles......Page 318 9.8.6 Implementation Strategies......Page 319 Figure 9-16. Watchdog Pattern Example......Page 320 Figure 9-17. Safety Executive Pattern......Page 321 9.9.4 Collaboration Roles......Page 322 Figure 9-18. Safety Executive Pattern Example......Page 324 References......Page 325 Parameterized Class......Page 327 Aggregation and Composition......Page 328 Generalization and Specialization......Page 329 Stereotypes and Classifiers......Page 330 Message Syntax......Page 331 Advanced Sequence Diagrams......Page 332 Use Case Relationships......Page 333 Deployment Diagram......Page 334 Package diagram......Page 335 State icon......Page 336 Sequential substates......Page 337 Pseudostates......Page 338 Submachines......Page 339 Activity Diagrams......Page 340 Appendix B. Pattern Index......Page 342
When creating real-time and embedded (RTE) systems, there is no room for error. The nature of the final product demands that systems be powerful, efficient, and highly reliable. The constraints of processor and memory resources add to this challenge. Sophisticated developers rely on design patterns—proven solutions to recurrent design challenges—for building fail-safe RTE systems.
Real-Time Design Patterns is the foremost reference for developers seeking to employ this powerful technique. The text begins with a review of the Unified Modeling Language (UML) notation and semantics then introduces the Rapid Object-Oriented Process for Embedded Systems (ROPES) process and its key technologies. A catalog of design patterns and their applications follows.
Key topics covered in this book include:
- Identifying large-scale strategic decisions that affect most software elements
- Coordinating and organizing system components and subsystems
- Managing memory and resources
- Defining how objects can be distributed across multiple systems
- Building safe and reliable architectures
- Mapping subsystem and component architectures to underlying hardware
The book's extensive problem-solving templates, which draw on the author's years in the trenches, will help readers find faster, easier, and more effective design solutions.
The accompanying CD-ROM contains:
- Related papers
- Object Management Group (OMG) specifications
- Rhapsody—a UML-compliant design automation tool that captures the analysis and design of systems and generates full behavioral code with intrinsic model-level debug capabilities
- RapidRMA—a tool that integrates with Rhapsody to perform schedulability and timeliness analysis of UML models
0201699567B08142002
Annotation When creating real-time and embedded (RTE) systems, there is no room for error. The nature of the final product demands that systems be powerful, efficient, and highly reliable. The constraints of processor and memory resources add to this challenge. Sophisticated developers rely on design patterns--proven solutions to recurrent design challenges--for building fail-safe RTE systems. Real-Time Design Patterns is the foremost reference for developers seeking to employ this powerful technique. The text begins with a review of the Unified Modeling Language (UML) notation and semantics then introduces the Rapid Object-Oriented Process for Embedded Systems (ROPES) process and its key technologies. A catalog of design patterns and their applications follows. Key topics covered in this book include: Identifying large-scale strategic decisions that affect most software elements Coordinating and organizing system components and subsystems Managing memory and resources Defining how objects can be distributed across multiple systems Building safe and reliable architectures Mapping subsystem and component architectures to underlying hardware The book's extensive problem-solving templates, which draw on the author's years in the trenches, will help readers find faster, easier, and more effective design solutions. The accompanying CD-ROM contains: Related papers Object Management Group (OMG) specifications Rhapsody--a UML-compliant design automation tool that captures the analysis and design of systems and generates full behavioral code with intrinsic model-level debug capabilities RapidRMA--a tool that integrates with Rhapsody to perform schedulability and timeliness analysis of UML models 0201699567B08142002 -- Applying a proven object technology concept to the unique, specialized area of real-time and embedded systems development. -- Practical and applicable -- helps reader apply proven solutions to recurring design challenges. -- The latest from Bruce Powel Douglass, a noted expert on real-time development. Real-time and embedded systems developers face unique challenges. The systems they design must use very limited processor and memory resources optimally to meet mission-critical and high reliability requirements. Developers working on these systems see the same common threads in problems again and again. The very best developers abstract these problems and their solutions into generalized approaches that prove consistently design patterns. In this book, real-time programming guru Bruce Powel Douglass collects the best design patterns from this unique, and rapidly growing, area of programming, and presents them in an instructional format that teaches the reader the "what, when, and how" of leveraging the significant power of these proven design solutions.