Advanced Design and System Patterns The Microkernel Pattern Advanced Design and System Patterns What is the Microkernel Pattern? Similar to Layers pattern Separate minimal functionality from extended functionality Able to adapt to customer-specific parts Originates from OS theory and research 2 Advanced Design and System Patterns Why use the Microkernel Pattern? When there is a need to adapt to changing system requirements Portability, extensibility and adaptability Easy integration of emerging technologies (e.g. emulation) 3 Advanced Design and System Patterns Roles to be played Internal server External server Adapter Client Microkernel 4 Advanced Design and System Patterns The Microkernel in more detail Implements central services Other components build on these basic services Encapsulation of system-specific dependencies These basic services are called atomic services (or mechanisms) 5 Advanced Design and System Patterns Internal Server (Subsystem) in more detail Extends functionality offered by the microkernel Separate component Encapsulates some dependencies on underlying hardware/software system Example: device drivers 6 Advanced Design and System Patterns External Server (Personality) in more detail Uses microkernel to implement its own view of the underlying application domain Layer on top of atomic services provided by microkernel Different external servers implement different policies from different application domains Example: OS/2 Warp 7 Advanced Design and System Patterns Client in more detail Application that is associated with exactly one external server It accesses the APIs provided by the external server 8 Advanced Design and System Patterns Adapter (Emulator) in more detail Protect clients and external server from direct dependencies Use adapter interface Example: no distinction between a native OS/2 Warp and microkernel support Implement as a Proxy (since Adapter refers to one external server) 9 Advanced Design and System Patterns Example: The CHORUS System Originated in INRIA (France) in 1990 High-performance UNIX emulation Distributed environments RT applications Integration with OOT 10 Advanced Design and System Patterns Chorus Architecture { { U1 U2 U3 User process User Address Space Kernel Address Space Unix Subsystem S1 Object-Oriented Subsystem S2 S3 System process K2 Kernel process K1 Microkernel 11 Advanced Design and System Patterns Example of a Microkernel System (Chorus) Unix Process PM PM Microkernel Xterminal IPCM Complete System SM Microkernel SM Microkernel Embedded System PM OM PM SM IPCM Microkernel Diskless Workstation 12 Advanced Design and System Patterns Test Case Windows NT Architecture OS designed to run programs from different environments DOS, 16-bit Windows, OS/2 Client-server model (programs run in User mode) Calls packaged and sent to Kernel via LPC 13 Advanced Design and System Patterns System Services User Mode System Services Object Manager ... Virtual Local Memory Procedure Call Facility Manager (LPC) I/O Manager File System Cache Systems Drivers } Kernel Mode Kernel Hardware Abstraction Layer (HAL) Hardware 14 Advanced Design and System Patterns General Features NT Executive is layered Some objects in charge of policy (e.g. Security Monitor) The Kernel is responsible for implementation 15 Advanced Design and System Patterns General Features (continued) Relaxed layered system (Kernel and I/O manager may access hardware directly) NT has a subsystem for each operating system 16 Advanced Design and System Patterns The Layers System services: interface layer between subsystems and NT Executive Resource management: Object Manager, Virtual Memory Manager etc. Kernel: basic functions (interrupt, thread dispatching...) 17 Advanced Design and System Patterns The Layers (continued) HAL: hides hardware differences between different processor families Hardware layer 18 Advanced Design and System Patterns The Kernel Bottom of the food chain Fundamental functions and objects Cannot be pre-empted 19 Advanced Design and System Patterns Responsibilities of the Kernel Scheduling threads Transferring control on interrupts and exceptions Synchronising multiprocessor operations Initiating system recovery after a power failure 20 Advanced Design and System Patterns Objects in Kernel Dispatcher objects (e.g. Mutex, Semaphore, Thread) Control objects (Process, I/O, Asynchronous Procedure Call) Represent more primitive attribute subset provided by corresponding User objects 21 Advanced Design and System Patterns Final Remarks Microkernel is a variant of Layers pattern Use Microkernel when clients have different views of underlying business logic (Buschmann) 22