Practical Protocol Composition, Encapsulation and Sharing in Kompics Cosmin Arad 1 and Seif Haridi 1,2 1 Royal Institute of Technology (KTH), {icarad,haridi}@kth.se 2 Swedish Institute of Computer Science (SICS), seif@sics.se Abstract. At the core of any distributed system is a set of concurrent distributed algo- rithms that coordinate the functionality of the distributed system. We present a software architecture, Kompics that is component-based and compositional which facilitates build- ing distributed protocols. The underlying computation model subsumes that of event-based systems, SEDA (staged event-driven architecture) and thread-based models. We illustrate various salient features of Kompics such as ease of use, compositionality and configura- bility through a series of well chosen distributed protocols. Key words: protocol composition, component model, reconfigurable distributed sys- tems architecture, publish-subscribe, event-based systems. 1 Introduction Programming distributed systems, applications and services is difficult due to concur- rency and partial failures, which are fundamental characteristics of distributed sys- tems, but also due to the complexity of the software architecture of any non-trivial distributed system. One way to simplify the understanding and programming of com- plex distributed protocols is to split them into their orthogonal aspects and encapsulate each of these aspects in reusable abstractions [6]. Combining multiple interdependent distributed protocols that are concurrently working together gives rise to complex interactions. We introduce Kompics, a novel software framework for programming, configur- ing, and executing distributed protocols as software components that interact asyn- chronously by passing data-carrying events. Kompics components are reactive, concur- rent, and they can be composed into complex architectures of composite components that are safely reconfigurable at runtime and allow for sharing of common subcom- ponents at various levels in the component hierarchy. Software faults occurring in components are isolated and handled by supervisor components organized in flexible supervisor hierarchies [2]. The component programming style encompasses both the event-based and the thread-based styles to facilitate programming most distributed protocols, and the ex- ecution model allows a flexible allocation of components to threads which enables var- ious resource allocation policies, and readily takes advantage of multi-core hardware architectures. The Kompics component model targets the development of reliable and adaptable long-lived, dynamic, and self-managing distributed systems. Such systems are com- posed of many software modules which implement various distributed protocols (e.g.