Transcription of Contents
1 Contents List of Figures ' ' ix Foreword * xi About This Book xv Chapter 0 Design Challenges, Middleware Solutions, and ACE 1. Challenges of Networked Applications 1. Networked Application Design Dimensions 5. Object-Oriented Middleware Solutions 7. An Overview of the ACE Toolkit 12. Example: A Networked Logging Service 17. Summary 19. Part I Object-Oriented Network Programming 21. Chapter 1 Communication Design Dimensions 23. Connectionless versus Connection-Oriented Protocols 23. Synchronous versus Asynchronous Message Exchange 26. Message Passing versus Shared Memory 28. Summary 31. vi Contents . Chapter 2 An Overview of the Socket API 33. An Overview of Operating System IPC Mechanisms 33.
2 The Socket API 34. Limitations of the Socket API 37. Summary 43. Chapter 3 The ACE Socket Wrapper Facades 45. Overview 45. The ACEJVddr and ACEJNET_Addr Classes 49. The ACEJPC-SAP Class 52. The Class 54. The ACEJ3 OCK_Connector Class 56. The ACE_SOCK_IO and ACE_SOCK_Stream Classes 60. The ACE_SOCKA cceptor Class 64. Summary 68. Chapter 4 Implementing the Networked Logging Service 71. Overview 71. The ACE_Message_Block Class 72. The ACEJ nputCDR and ACE_OutputCDR Classes 76. - The Initial Logging Server 80. The Client Application 95. Summary 99. Part II Concurrent Object-Oriented Network Programming 101. Chapter 5 Concurrency Design Dimensions 1O3. Iterative, Concurrent, and Reactive Servers 103.
3 Processes versus Threads 109. Process/Thread Spawning Strategies 112. User, Kernel, and Hybrid Threading Models 114. Time-Shared and Real-Time Scheduling Classes 119. Task-versus Message-Based Architectures 121. Summary 123. Contents Vii Chapter 6 An Overview of Operating System Concurrency Mechanisms 125. Synchronous Event Demultiplexing 125. Multiprocessing Mechanisms 127. Multithreading Mechanisms 129. Synchronization Mechanisms 130. Limitations with OS Concurrency Mechanisms 135. Summary 137. Chapter 7 The ACE Synchronous Event Demultiplexing Wrapper Facades 139. Overview 139. The ACE_Handle_Set Class 141. The ACE_Handle_Set_Iterator Class 147. The ACE: :select() Methods 151.
4 Summary 157. Chapter 8 The ACE Process Wrapper Facades 159. Overview 159. The ACE_Process Class 161. The ACE_Process_Options Class 165. The ACE_Process_Manager Class 169. Summary ' 182. Chapter 9 The ACE Threading Wrapper Facades 185. Overview 185. The ACE_Thread_Manager Class 187. The ACE_Sched_Params Class 198. The Class 201. Summary 205. Chapter 10 The ACE Synchronization Wrapper Facades 2O7. Overview 207. The ACE_Guard Classes 209. The ACE Mutex Classes 212. The ACE Readers/Writer Lock Classes 218. The ACE Semaphore Classes 222. The ACE Condition Variable Classes 229. Summary 233. Viii Contents . Appendix A Design Principles for ACE C++ Wrapper Facades 235.
5 A. 1 Overview 235. A. 2 Use Wrapper Facades to Enhance Type Safety 236. A. 3 Simplify for the Common Case 238. A. 4 Use Hierarchies to Enhance Design Clarity and Extensibility 246. A. 5 Hide Platform Differences Whenever Possible 248. Optimize for Efficiency 255. A. 7 Summary 257. Appendix B The Past, Present, and Future of ACE 259. The Evolution of ACE 259. The Road Ahead 267. Concluding Remarks 268. Glossary 269. Bibliography 285. Index 295. List of Figures A Stand-alone Application Architecture 2. A Common Networked Application Environment 3. Networked Application Design Dimensions 6. Object-Oriented Middleware Layers in Context 8. The Layered Architecture of ACE 13.
6 Participants in the Networked Logging Service 18. Alternative Connection Multiplexing Strategies 25. Synchronous versus Asynchronous Messaging Strategies .. 26. Message Passing versus Shared Memory 29. Taxonomy of Socket Dimensions 42. The ACE Connection-Oriented Socket Class Relationships . 47. Taxonomy of the ACE Socket Wrapper Facades 48. Roles in the ACE Socket Wrapper Facade 49. The ACEJVddr and ACE_lNET_Addr Class Diagrams 51. The ACE_IPC_SAP and ACE_SOCK Class Diagrams 54. The ACE_SOCK_Connector Class Diagram 57. The ACE_SOCK_Stream and ACEJ3 OCK_IO Class Diagrams .. 61. The ACE_SOCK_Acceptor Class Diagram 65. The ACE_Message_Block Class Diagram 73.
7 Two Kinds of ACE_Message_Block 75. ix LIST OF FIGURES. The ACE_lnputCDR and ACE_OutputCDR Class Diagrams .. 79. Logging Server Example Classes 81. Message Block Chain of Log Record Information 90. Iterative/Reactive versus Concurrent Servers 104. Multiprocessing versus Multithreading 109. Thread Pool Eager Spawning Strategies 113. Thread-per-Request On-Demand Spawning Strategy 113. TheN:l and 1:1 Threading Models 115. The N:M Hybrid Threading Model 117. Task-Based vs. Message-Based Concurrency Architectures . 122. & ACEJ iandle J3et iterator Class Diagrams 140. Architecture of a Reactive Logging Server 153. The ACE Process Management Class Relationships 160.
8 The ACE_Process Class Diagram 163. The ACE_Process_Options Class Diagram 167. The ACE_ProcessJVIanager Class Diagram 170. Architecture of the Multiprocessing Logging Server 171. Master/Worker Process Creation Sequence for POSIX .. 174. Master/Worker Process Creation Sequence for Win32 .. 175. The ACE_Thread_Manager Class Diagram 189. Architecture of the Thread-per-Connection Logging Server . 193. The ACE_Sched_Params Class Diagram 200. The ACE_TSS Class Diagram 203. The ACE_LOCK* Pseudo-class 209. ACE_Guard Family Class Diagrams 210. ACE_Condition_Thread_Mutex Class Diagram 230. ACE_Recursive_Thread_Mutex Class Diagram 231. A. 1 Functions in the Socket API 247.
9 A. 2 The ACE IPC Addressing Hierarchy 248. Standards-Compliant Middleware Based on ACE 264. Foreword As I write this foreword I'm traveling through Europe, relying on the excel- lent European public transportation infrastructure. Being an American, I'm fascinated and amazed by this infrastructure. Wherever I land at an airport I have easy access to trains and buses that are fast, clean, reliable, on time, and perhaps most importantly, going directly to my destination. Departure and arrival announcements are available in multiple languages. Signs and directions are easy to follow, even for non-native speakers like me. I live and work in the Boston area, and like most Americans I rely almost entirely on my automobile to get from one place to the next.
10 Except for an occasional use of the Boston subway system, I use my car to get around because the public transportation infrastructure is too limited to get me to my destination. Since millions of others in Boston and elsewhere are in the same predicament, our highway infrastructure is now well past the point of coping with the traffic volume. I know I'd be appalled if I knew exactly how much of my life I've wasted sitting in traffic jams. There are some interesting similarities between networked computing systems and transportation systems, the most significant of these be- ing that the success of both depends on scalable infrastructure. Scal- able transportation systems comprise not just obvious infrastructure ele- ments, such as trains and rails or airplanes and airports.