Home > Library > White Papers
smx Kernel vs. Thin Kernels

by Ralph Moore
smx Architect

smx offers rich functionality intended to help users implement their systems more easily and efficiently. It also provides many safety features intended to reduce debug time and to increase final product reliability. smx offers the following features that thin kernels do not. For more details, see smx Advanced Features and the other links below.
  1. Graphical Analysis Tools for smxAware. The event timeline display shows when all tasks, LSRs, and ISRs ran and what smx calls occurred in each. The display can be zoomed in to show as much detail as needed. The stack usage display shows stack usage per task and alerts of near and actual overflows. The CPU usage display show % time used by each task, LSR, and ISR. The memory window shows how much is used of DARs, heap, stack pool, and each type of control block. See datasheet.
  2. Link Service Routines. LSRs provide a good mechanism for deferred interrupt processing, low-jitter timer operations, and other very-high priority processing. They cannot be blocked by tasks and so avoid priority inversion problems. LSRs enable smx to have ultra-low interrupt latency. See article.
  3. One-Shot Tasks. smx supports both normal and one-shot tasks. One-shot tasks share stacks from a common pool and release them back to it when done. This can greatly reduce RAM usage and also may permit using on-chip SRAM for task stacks, thereby achieving much higher performance. See article.
  4. Unlimited Number of Tasks: smx is designed to support a very large number of tasks efficiently.
  5. Multiple Tasks per Priority Level. smx permits tasks to share the same priority and it dispatches the longest waiting task at the current top priority level to run first. This is a more natural scheduling algorithm than one task per priority.
  6. Layered Ready Queue. smx has a separate queue per priority level. Scheduling is a fast two step process (index to the level and link to its end) regardless of how many tasks are in the ready queue. See Advanced Features.
  7. System Stack. ISRs, LSRs, scheduler, and error handling use the system stack, so they do not add to every task’s stack requirement. This saves significant RAM for systems with many tasks, which we recommend for good system design.
  8. Mutexes. Because smx permits tasks to share priority levels, it has a more efficient scheme of priority inheritance promotion that boosts the current mutex owner only as high as the highest priority waiting task. In addition smx implements priority promotion propagation between mutexes to prevent unbounded priority inversion when multiple mutexes must be tested. smx mutexes also implement priority ceiling promotion, which is necessary for Deadline Monotonic Analysis. They permit a combination of  promotion schemes for optimum performance and safety. Also, smx mutexes support staggered priority demotion for tasks holding multiple mutexes, so the task priority does not remain boosted at a higher level than necessary for the remaining mutexes it holds, after releasing one. This avoids blocking higher priority tasks longer than necessary. See article.
  9. Versatile Messaging. smx allocates a Message Control Block (MCB) per message, which contains the following information and has the following advantages:
    1. Protected data pointer. The MCB must be valid and the data pointer always points to the start of the message. It cannot be left pointing to the middle or end, due to a programming error.
    2. Size helps to control overrun errors.
    3. Owner prevents memory leaks when owners are deleted, by deleting messages they own.
    4. Priority allows more important messages to be passed around less important messages.
    5. Priority pass. Pass exchanges permit a message priority to be passed to a receiving task. Thus a server task can automatically adopt the same priority as the client task that it is serving.
    6. Reply address tells a server task where to send a response or processed message.
    7. Return pool tells where to send a message no longer needed.
    8. Forward and backward links allow MCBs to be linked into exchange lists. Hence message queues may be of any length.
  10. Exchanges. Messages are sent to and received from exchanges. Exchanges allow messages to wait for tasks or tasks to wait for messages. The latter is useful to control access to shared resources. Messages can contain resource information such as port numbers, keys, passwords, sizes, etc.
  11. Event Tables. These permit tasks to wait for the AND or OR of up to 31 events. Different tasks can wait for different combinations of the same events.
  12. Event Queues permit an efficient way for tasks to wait for specified numbers of events (e.g. ticks). Only the counter in the first TCB in the queue is decremented for each event, for efficiency.
  13. Dynamically Allocated Regions. Modern embedded systems have many kinds of RAM: on-chip SRAM, off-chip SRAM, DRAM, non-cached RAM, cached RAM, system RAM, application RAM, etc. DARs help to manage this complexity more easily.
  14. Low Jitter Timers. smx provides both one-shot and cyclic timers. These are useful for timeouts and for triggering repetitive operations. Because smx timers directly invoke LSRs when they time out, timer code runs ahead of all tasks and is immune to priority inversions. Since LSRs can be interrupted only by ISRs, which should be short, timer jitter is minimal.
  15. Precise Profiling. Run-time counts are accurate from one to several instruction clocks. Each task has its own run-time counter; ISRs and LSRs are counted in aggregate. This information is displayed in graphical and tabular form in smxAware.
  16. Precise Time Measurement. APIs are provided to measure short sections of code with accuracy from one to several instruction clocks.
  17. Error Detection. smx monitors about 70 error types. It provides for point of occurrence error handling and central error handling. The smx error management system includes an error buffer, error counters, error service routine, and error message display functions.
  18. Excellent Manuals. smx offers very detailed and complete manuals. There are four: User’s Guide, Reference Manual, Target Guide, and Quick Start. The User’s Guide is like a tutorial book. The other manuals go into greater detail.

In contrast to smx, thin kernels are characterized by simplistic code, inadequate documentation, and superficial debug tools.

Please contact me with any comments or questions about this article.

Ralph Moore
smx Architect
Micro Digital Inc


back to White Papers page