Skip to content

Microkernel Design Pattern

The Microkernel Architecture Pattern can be identified as a plug-in based pattern. Also known as the plug-in architecture pattern, it consists of two main components: the core system and plug-in components.

Category

PlatformHub Integration

Scope - Problem

As we have many issues with monolithic Architecture in MobileX like app-size, performance, scalability, security, code complexity... we mitigate all these issues with the help of a modular pattern. Hence, it is MobileX's requirement to migrate the monolithic Architecture to a modularised/plugin base Architecture.

Scope - Pattern Context

The concept of Microkernel as Software Architecture Pattern has emerged from the principle of design of an Operating System, where the system is modularised basically in two parts: Kernel and the System Software. The kernel is the heart of the operating system, whereas System Software is the other part of the body. The kernel is responsible for memory management, process management, inter-process communication, etc.

When to Use This Pattern

We can use an Adapter pattern for below cases.

When you want to use some existing class but its interface isn’t compatible with the rest of your code. When you want to reuse several existing subclasses that lack some common functionality that can’t be added to the superclass. In MX case, as per the new simplified API contract and API calling mechanism designed for PlatformHub, the requirement is to translate the new api call to the legacy api call in the existing legacy journeys/component, hence the Adapter is useful when you have to establish an interaction between two objects with different interfaces.

Design and Implementation

High Level View

Microkernel pattern

Reference Class Structure

This implementation uses the object composition principle: the adapter class (i.e: Plugin Own Interface) implements the interface of one object and wraps the other one inside (i.e: PlatformHub Plugin Interface). Microkernel pattern class diagram

Code

PlatformHub Plugin Interface

Issues and Considerations

  • When the drivers are implemented as procedures, a context switch or a function call is needed, that will increase processing time.
  • In a microkernel system, providing services are more costly than in a traditional monolithic system.
  • The performance of a Microkernel system might be indifferent and cause issues.
  • Do all network call in a centralised way will help to track and analyse the traffic at single place.
  • Implement threads in the correct places and for the correct scenarios will help to increase performance and reduce the Microkernel overhead.
  • Avoid service duplication will increase service execute time.

Forces and Constraints

  • Must follow all protocols defined by PlatformHub for communication and all types of activities.
  • Avoid direct communication between journeys, route it through PlatformHub.
  • Before creating any journey/plugin follow the Architectural guidelines.

Read More Patterns