Files
MuditaOS/module-sys/SystemManager/doc/ServicesSynchronization.md
Adam Dobrowolski 1cb4da819d [MOS-307] Application and Service example and docs
Working example of application and service ready to copy from
with minimum documentation
Apply suggestions from code review
Co-authored-by:
* Paweł Olejniczak <58421550+pawel-mudita@users.noreply.github.com>
* Paweł Joński <79840715+paweljonskim@users.noreply.github.com>
* Bartosz Cichocki <sp2fet@gmail.com>
2022-03-28 08:17:39 +02:00

1.3 KiB

Services synchronization

If a service has dependencies to other services, it should be started after its dependencies are started.

For example, a ServiceA may be dependent on the ServiceDB. It means that the ServiceA can not be started unless the ServiceDB successfully starts.

It is a part of the Services Synchronization feature to order services based on their dependencies.

Service Manifest

Each service should export its manifest. The manifest may contain the following information:

  • name
  • dependencies to other services
  • start timeout

WARNING: Currently there is no fail-safe mechanism to handle service startup failure - it will cause non-handled exception SystemInitialisationError{"System startup failed: unable to start a system service."};

Please see: ServiceManifest.hpp to check current defaults

The System Manager needs to read the manifests to run the services in the correct order.

Synchronization algorithm

The topological sorting algorithm may be used to build a linear ordering of services that are to be started by the System Manager.

Important note: The Dependency Graph implementation handles Directed Acyclic Graphs only.