mTags: Augmenting Microkernel Messages with Lightweight Metadata Augusto Born de Oliveira Department of Electrical and Computer Engineering University of Waterloo, Canada a3olivei@uwaterloo.ca Ahmad Saif Ur Rehman Department of Electrical and Computer Engineering University of Waterloo, Canada asaifurr@uwaterloo.ca Sebastian Fischmeister Department of Electrical and Computer Engineering University of Waterloo, Canada sfischme@uwaterloo.ca ABSTRACT In this work we propose mTags, an efficient mechanism that augments microkernel interprocess messages with lightweight metadata to enable the development of new, system-wide functionality without requiring modification of the applica- tion source code. As such it is well suited for systems with a large legacy code base or third-party applications like phone and tablet applications. We explored mTags in a variety of different contexts in local and distributed system scenarios. For example, we detail use cases in areas including messaging-induced deadlocks and mode propagation. To demonstrate that mTags is techni- cally feasible and practical, we implemented it in a com- mercial microkernel and executed multiple sets of standard benchmarks on two different computing architectures. The results clearly demonstrate that mTags has only negligible overhead and strong potential for many applications. 1. INTRODUCTION Software integration poses a challenge for system develop- ers. Closed-source software makes integration and the de- velopment of system-wide functionality difficult. Access to all source code can simplify this effort, but retrofitting a system-wide feature into a large code base will still be very time consuming. In the absence of source code, software integration and system- wide functionality can still be retrofitted from the operating system side. For example, tracing, profiling and deadlock detection are all dynamic functionalities that require run- time access to a program’s execution flow, but are orthog- onal to program functionality. Implementing them without changing their target program’s source code has the benefit of making them instantly reusable with other programs. One way to provide dynamic access to a program’s execution flow is to attach information with programs and propagate this information as the program communicates with other system components. Other programs or the operating sys- tem can then act upon this metadata to integrate the appli- cations and implement the required functionality. Tracing, for example, could be performed by attaching a marker to a program and logging its trajectory as that program commu- nicates with other system components. This has been done with great overhead on the system by past work [25]. In this work we propose mTags, an efficient mechanism for attaching lightweight metadata with threads and propagat- ing it along with messages in a microkernel OS. mTags en- ables the development of new, system-wide functionality without requiring modification of application source code. The well-defined messaging interface present in microkernels allows precise tracking of information exchanges between threads, and serves as a foundation for mTags’ metadata propagation mechanism. To evaluate the concept, we implemented a full prototype of mTags on a commercial microkernel and tested several use cases ranging from simple tracing to deadlock detection to mode change propagations. We show that mTags can be used to detect message-passing–related deadlocks between threads and to implement new system-wide features through mode changes in the presence of closed-source applications. By using microkernels as a base, mTags support transparent distribution. Our evaluation shows that mTags has only negligible overhead on system performance, while enabling the implementation of functionality with a fraction of the effort necessary otherwise. The remainder of the paper follows this structure: Section 2 introduces the system model and terms for mTags. Sec- tion 3 defines measures that can be used to limit tag prop- agation. Section 4 outlines our implementation using the QNX Neutrino microkernel system. Section 5 motivates why our approach is useful by listing different use cases. Sec- tion 6 describes our experimental method to evaluate the system. Section 7 discusses the results of the measurements and evaluation. Section 8 goes over some of the related work. Section 9 discusses lessons learnt and specific corner cases. Section 10 describes our future work plans for mTags. Finally, Section 11 sums up and closes the work. 2. SYSTEM MODEL & TERMINOLOGY Our approach assumes a microkernel architecture for the op- erating system similar to QNX [14], Chorus [30], Mach [1], Singularity [15] and L4 [23]. The microkernel strictly divides essential and optional services. A service can range from sys- tem services such as virtual memory, file servers, and device drivers, to user services like applications, web servers, and database server. The microkernel itself implements services such as a messaging layer, low-level hardware access while other services, for example drivers and managers execute in user-space. System threads implement microkernel ser-