RTOS-32
 
RTKernel-32:Real-Time Scheduler for On Time RTOS-32
    RTKernel-32 Threads
An RTKernel-32 thread is implemented as a C/C++ function. A program can dynamically create threads using the appropriate kernel API calls. These threads are subsequently executed in parallel with the main thread and any other threads.
Each thread has its own stack, a priority between 1 and 64, and a task state. Several threads can be started executing the same code; however, each is allocated its own stack and thus its own local variables. All threads have access to the program's global data. Thus, shared code and shared data are inherently implemented by RTKernel-32.
    Inter-Task Communication
     RTKernel-32 offers three different mechanisms for inter-task communication:
  • Semaphores allow the exchange of signals for activating and suspending threads. RTKernel-32 supports counting, binary, event, resource, and mutex semaphores, and critical sections. Resource and mutex semaphores implement priority inheritance.
  • Mailboxes (also known as queues or FIFO buffers) allow threads to exchange messages asynchronously. The maximum number and size of messages can be configured for each mailbox. High priority messages can be sent to a mailbox ahead of all others. Mailboxes can also be used to send data from hardware interrupt handlers and threads.
  • Message-passing is used for asynchronous exchange of messages. No data is buffered, data is sent directly from one thread to another.
    Performance
RTKernel-32 offers excellent performance. It comes with a benchmark program that may be used to measure its performance on any computer. The table below gives some results for three typical target computers. RTKernel-32's scheduler is about 15 times faster than that of Windows 95 and five times faster than Windows NT's scheduler.
20 MHz 386EX
100 MHz AMD Élan SC520
1.4 GHz Pentium IV
RTKernel-32 Operation
43
1.45
0.07
Round-Robin task switch
79
2.88
0.20
Semaphore task switch
37
3.31
0.18
Semaphore Signal
25
3.84
0.10
Semaphore Wait
100
6.20
0.39
Task activation (Signal, Wait)
31
4.21
0.12
Store data in a mailbox
30
5.87
0.18
Retrieve data from a mailbox
96
5.70
0.34
Task-to-task communication
107
11.83
0.38
Task-to-mailbox-to-task communication
Times are given in microseconds.
     The Scheduler
RTKernel-32's scheduler is event-driven. It was developed specifically for real-time requirements and adheres to the following rules:
  •  
    Priority Scheduling
    Of all threads in state Ready, the thread with the highest priority runs.
  •  
    Round-Robin Scheduling
    If the kernel must choose from several Ready threads with the same priority, the thread that hasn't run for the longest time is activated.
  •  
    Priority Ordered Queues
    If several threads are waiting for an event, they are activated upon the occurrence of that event in sequence of their priorities.
  •  
    Deterministic Scheduling
    With the exception of time-slice task switches, a task switch is only performed if otherwise rule 1 would be violated.
The application can dynamically change thread priorities and it can turn preemptions and time-slicing on and off at run-time.
      Interrupts
The application's interrupt handlers can suspend or activate threads. Interrupt handlers can be programmed completely in C/C++ within the application. They can freely exchange signals or data with threads using semaphores or mailboxes. Semaphore or mailbox operations may then initiate a task switch, if required. Interrupts from any hardware can be processed. Interrupt sharing for PCI devices is also supported.
      Debugging
RTKernel-32 is delivered in two versions. The Standard Version is optimized for minimum size and best performance, while the Debug Version contains additional code for parameter and consistency checks at run-time. The Debug Version recognizes usage errors and issues corresponding error messages. Moreover, the Debug Version offers various debugging aids. For example, the current source code position of a thread can be displayed, all locked resources can be listed, or the CPU time requirements can be determined for each thread and interrupt handler. An especially powerful tool is the Kernel Tracer; it can log kernel and application events in real-time for off-line analysis.
As an additional aid to debugging, RTKernel-32 (Debug and Standard Version) offers a number of informational functions. For example, a list of all threads, semaphores, or mailboxes can be displayed, or the state of a specific thread can be queried. Furthermore, RTKernel-32 keeps statistics of the stack usage of all threads and interrupt handlers.
      Win32 Emulation
To allow porting existing multithreaded programs from Win32, almost all Win32 thread API functions are supported by RTKernel-32. Applications can use Win32 threads, events, mutexes, semaphores, and critical sections. Unlike Windows, RTKernel-32 allows hardware interrupt handlers and hardware accesses within the application code.
      Supplemental Modules
RTKernel-32 is supplied with the following supplemental modules, always delivered in full source code:
  •  
    FineTime - high resolution time measurement
  •  
    Clock - timer interrupt management
  •  
    RTCom - interrupt-driven serial I/O for up to 38 ports
  •  
    RTKeybrd - keyboard support
  •  
    RTTextIO - screen window management
  •  
    CPUMoni - CPU load analysis
  Home