Tics Realtime -----


 
Home Services Products Tutorials Contact Us
- - - - -

Essential Features of a Real-time Kernel

First and foremost, a real-time kernel must in fact behave in a real-time manner as described in a previous article. However, to be useful, it should in addition have the following basic features.

  1. Task Management.
  2. Timer Management.
  3. Message Management.
  4. Memory Management.

Each of these is detailed below.

Task Management

Task management includes the following.

  1. Task Creation.
  2. Task Scheduling.
  3. Task Priorities.
  4. Task Deletion (optional)

Task Creation

Ideally task creation should be dynamic; that is task creation should be allowed during run-time. Systems that allow only static task creation (done at compile time by filling in a table for example) are less flexible, but by no means unusable. Most real-time systems do not require dynamic task creation, and furthermore, dynamic task creation can be effectively simulated by creating the maximum number of tasks at compile time, and enabling each as system requirements demand it.

Task Scheduling

A flexible system will allow task scheduling via events, time-slicing, or cooperation or any mix of the preceding.

Task Priorities

Priority based preemptive scheduling is an important feature and has been detailed in a previous article. Priorities must be real-time responsive, and preferably dynamic.

Task Deletion

The ability to delete a task is a useful feature in dynamic environments.

Timer Management

Timer management should provide for pause, one-shot timers, periodic timers, and differential timer management. In addition, it is important that a timer be dispatched as a message to the task that started the timer. In this way much flexibility is added. For example, message aliasing can be used to allow taskA to start a timer for taskB; message cancellation can be used to cancel a timer, and so forth. Basically, any of the features of the message management system can be used to facilitate timer management.

Message Management

Messages are used for inter-task communication and the kernel message management system should have at least the features outlined below.

Message Queuing

Sometimes a burst of requests can be sent to a task and in this case the messages must by saved in a queue so that the task can process each message in turn.

Variable Size Messages

Since messages can have varying amounts data, the kernel should allow for variable size messages. This can be accomplished by reserving one field of the message for a data pointer. For smaller data items a fixed block of bytes is typically reserved in the message for convenience.

Wait on a Message

Tasks that expect messages should be able to suspend, if they so desire, until a message arrives; this is referred to as the ability to "wait" for a message.

Selective Wait on a Message

A task should be able to wait for a particular message, or any one of a list of messages, or for any message at all regardless of its message id number.

Message Aliasing

Sometimes it is convenient for taskA to send a message to taskB, but force taskB to respond to taskC. This can be done if taskA can change to sender field in the message so that when taskB responds to the sender, he really responds to taskC.

Timed Wait on a Message

Sometimes you only want to wait so long for a message and then time out.

Peeking

Sometimes it is convenient for a task to peek into its message queue and scan the messages, but remove none, leaving the queue intact.

Message Priorities

Sometimes it is important to have the ability to assign priorities to messages. Consider taskA which has 5 messages in its queue. If taskB determines that an emergency stop is required, and sends taskA an EMERGENCY_STOP message, then without message priorities, this important message would be number 6 in the queue. However, by sending the message with a higher priority, it can be forced to the front of the message queue.

Message Identity

It is important for the receiver of a message to know who sent the message so that he can respond if necessary.

Message Throttling

This feature allows the programmer to specify, on a queue by queue basis, the maximum number of messages allowed.

Memory Management

The kernel should provide for high speed deterministic memory management. Fixed block memory management is preferred because of its high speed and the elimination of fragmentation.


We welcome comments. Let us know what subjects you would like written up. Send comments to mike@Ticsrealtime.com

Copyright © 1992-2004, Tics Realtime