Sie sind auf Seite 1von 11

Dear Prospective Customer,

This demo diskette serves to introduce you to the features of the


real-time multi-tasking kernel RTKernel-C 4.5. This text contains:
* an overview of RTKernel's features
* explanations of the terms "RTKernel Task" and "Inter-Task
Communication" as well as the scheduler's method of operation
* a short description of each module delivered with RTKernel
* a description of the demo programs
This disk contains four demo programs, the corresponding source files,
and some of the header files that come with RTKernel. A list of all
files on the demo disk follows.
RTDEMO.EXE
COMDEMO.EXE
IPXDEMO.EXE
RTPRIMES.EXE

The demo programs in executable form.

RTDEMO.C
COMDEMO.C
IPXDEMO.C
RTPRIMES.C

C source code of the four demo programs. The programs


are described in this text and, in more detail, in the
respective source files.

RTKERNEL.H

Header file of module RTKernel.

RTCOM.H
RTIPX.H
RTKEYBRD.H
RTTEXTIO.H
SPOOLER.H
CPUMONI.H
ITIMER.H
TIMER.H
IPC.H
RTVISION.H
KILLKEY.H
RTKDPMI.H

Header files of the supplemental modules that come with


RTKernel in complete source code. A short description
of each module is given in this text and, in more
detail, in the respective header file.

TECHINFO.TXT

This text.

README.TXT

Usage notes for the demo programs.


Features of RTKernel

RTKernel is a powerful real-time multi-tasking system. It was designed


for software developers who wish to implement professional process
control applications on MS-DOS computers. Every effort has been made
to ensure easy usage and excellent run-time performance. RTKernel is
compact (about 16K of code, 6K of data) and provides the programmer
with the basic tools needed to develop efficient real-time software.
The main features of RTKernel:

* Unlimited number of tasks


RTKernel can handle as many tasks as will fit into the computer's
available RAM. One task requires only about 500 bytes.
* Task switch time of about 6 microseconds (486/33)
RTKernel offers unequaled performance for such a powerful system.
* Task switch time remains constant for any number of tasks
Many multi-tasking systems exhibit severely reduced performance
when too many tasks are activated. RTKernel's performance is
independent of the number of tasks activated.
* 64 priorities
The behaviour of programs may be fine-tuned precisely using
different priorities.
* Cooperative and preemptive scheduling
During preemptive scheduling, task switches may take place at
practically all times. Tasks may be activated directly out of
interrupt handlers. Preemptive scheduling is implemented by
RTKernel using not only the timer interrupt, but any interrupt
source. In cooperative scheduling, task switches only take place
when the program allows it.
* Support of math coprocessor / emulator
If a math coprocessor is installed, it can be utilized by any
number of tasks. Its registers can be conserved by RTKernel during
task switches. The 8087 software emulator is also supported.
* Interrupt support
Using RTKernel, it is possible to exchange data with other tasks
and to suspend or activate tasks out of interrupt handlers. The
interrupt priorities of the interrupt controller can be
re-programmed in order to achieve the best possible interrupt
response times. This qualifies RTKernel for high-speed data
acquisition, communications, process control, and similar tasks.
* Time-slicing
RTKernel can be used as a time-sharing system, sharing CPU time
evenly among a number of tasks.
* Semaphores
Semaphores can be used to exchange signals between tasks and to
protect resources. Semaphores may also be used by interrupt
handlers.
* Mailboxes
Mailboxes can be used to exchange data between tasks. Mailboxes
may also be used by interrupt handlers (e.g., for data buffering).
* Message-Passing
Message-passing can be used to exchange data between tasks
directly. This synchronizes the tasks involved.
* MS-DOS reentrance problem solved
RTKernel can sequentialize DOS-calls from different tasks.
Therefore, tasks can perform DOS-I/O without consideration of
DOS's non-reentrance. This is done automatically by RTKernel. In
the application code, not a single statement needs to be inserted
before or after DOS-calls. A task switch may take place even while

a task is executing DOS code.


* Resident RTKernel-applications (TSRs)
Using resident RTKernel-applications, arbitrarily complex programs
can run in the background while the computer is used for other
purposes in the foreground. Even Windows can run in the foreground
while a real-time application is running in the background.
* RTKernel-applications can execute other programs
RTKernel offers its own EXEC function which may be used to execute
other programs (e.g., to format a diskette in the background).
Even Windows can be started by a task in this manner.
* Hard disk and floppy disk idle times usable by other tasks
Idle times during read/write operations from/to floppy disks or
hard disks (e.g., head seek times) are made available to other
tasks. The throughput of programs performing much file I/O can be
increased considerably in this way.
* Support of peripheral hardware
RTKernel comes with drivers for the screen, keyboard, serial
ports, parallel ports, and Novell Netware. These modules guarantee
the best possible usage of your peripheral hardware. All drivers
come with complete source code for easy adaptability to
non-standard hardware. However, the standard DOS drivers may also
be used.
* Simple and safe usage
Using RTKernel is learned quickly, thanks to its orthogonal
design. RTKernel is based on a small number of simple concepts.
Since all tasks run within one program, many features are
"automatically" implemented (e.g., shared memory and shared code).
In this way, learning time is minimized. Furthermore, the debug
version of RTKernel performs many run-time error checks to ease
program development.
* Runs on any MS-DOS compatible computer
RTKernel will run on any computer that runs under MS-DOS, version
3.0 or higher, and compatible systems. Toolboxes and libraries
from third-party suppliers can normally be used together with
RTKernel without problems.
* Supports Real and Protected Mode
When used with Borland C++, RTKernel can run in Protected Mode.
This enables the RTKernel application to utilize up to
16 megabytes of physical memory and up to 120 megabytes of virtual
memory.
* Runs Windows or DOS Extender applications as a task under RTKernel
RTKernel can execute Windows or a DOS-Extender application as an
RTKernel-task. This allows real-time processing to be performed in
parallel with Windows (which does not offer real-time
capabilities).
* ROM-able
RTKernel may be installed in dedicated systems running from ROM or
EPROM. RTKernel may be configured such that MS-DOS is not
required.

RTKernel Tasks
All RTKernel tasks run within one program. A task consists of a C
function without parameters and with its own stack. Each task has a
priority between 1 and 64. A high priority means high urgency. Within
a program, priorities are only meaningful relative to each other.
The stack of a task contains all variables declared local to the task
function. The same is true for local variables of all functions called
from that task. Consequently, several tasks may be started with the
same task function, but each would have its own stack and its own
local variables. The common C visibility rules fully apply to
multi-tasking programs. All tasks may access global data.
RTKernel maintains a task state for each task. The fundamental states
are:
Ready

All tasks ready to run are in the state Ready. One of these
is the active task.

Suspended Suspended tasks cannot run because they have been stopped
explicitly by the RTKernel operation Suspend. They can only
be made Ready by the RTKernel function Resume.
Blocked

Tasks in the state Blocked cannot run because they are


waiting for an event (e.g., a semaphore signal or a message
coming in at a mailbox). These tasks can only be made Ready
by another task or an interrupt handler.

Delaying These tasks have suspended themselves for a certain time


interval. They will be made Ready automatically by the timer
interrupt handler of RTKernel.
Timed

Tasks waiting for the occurrence of an event with a time-out


are in the state Timed. Such a task will become Ready either
if the event occurs or if the time-out expires.

RTKernel's scheduler is event-driven. It is not primarily a


time-slicing system based on the timer interrupt, like many others. It
was developed specifically for real-time requirements and adheres to
the following rules:
1. Of all tasks in the state Ready, the task with the highest
priority runs.
2. If the kernel has to choose among several Ready tasks having the
same priority, the task that hasn't run for the longest time is
activated.
3. If several tasks are waiting for an event, they are activated
upon the occurrence of that event in the sequence of their
respective priorities.
4. With the exception of time-slice task switches, a task switch is
only performed if otherwise rule 1 would be violated. The number
of task switches is minimized.
Since these rules are followed strictly, the behavior of the tasks of
a program can be controlled precisely. Both cooperative and preemptive
scheduling are available. Also, the scheduler may be disabled

temporarily; a task switch at fixed time intervals can be forced using


(optional) time-slicing.
Inter-task Communication
The term inter-task communication comprises all methods enabling tasks
to exchange information among each other. RTKernel offers three
different mechanisms: semaphores, mailboxes, and message-passing.
Semaphores allow the exchange of signals for activation and suspension
of tasks. A semaphore is a variable signals can be stored in or read
from. Task switches may take place whenever a semaphore containing 0
signals is addressed. RTKernel supports counting, binary, and resource
semaphores.
Resource semaphores are especially suited for the efficient management
of resources. A resource semaphore guarantees the priority of a task
occupying a resource to be at least the maximum of the priorities of
all other tasks also requiring the respective resource. This technique
is known as "priority inheritance". It ensures that a high-priority
task is never uneccessarily blocked by a task of lower priority.
Using mailboxes, data can be exchanged between tasks. The number of
data records a mailbox can hold is configurable. Mailboxes are
especially suited for data buffering between tasks or between
interrupt handlers and tasks.
Message-passing serves to exchange data directly between two tasks;
specifically, no data or signals will be buffered. This represents the
tightest coupling between tasks because the tasks involved are
synchronized by RTKernel for the exchange. Therefore, communication
via message-passing usually leads to more task switches than, for
example, communication using mailboxes.
Performance
RTKernel offers remarkable performance for its power. It comes with a
benchmark program that can be used to measure its performance on any
computer. Some results for three typical computers are (in
microseconds):
33 Mhz | 20 Mhz | 12 Mhz |
80486 | 80386 | 80286 | RTKernel Operation
-------+--------+--------+------------------------------------6 | 27 | 58 | round-robin task switch
10 | 42 | 89 | semaphore task switch
3 | 13 | 22 | semaphore Signal
2 |
8 | 13 | semaphore Wait
14 | 65 | 115 | task activation (Signal, Wait)
7 | 20 | 35 | store data in a mailbox
7 | 21 | 39 | retrieve data from a mailbox
18 | 63 | 114 | task-to-task communication
24 | 77 | 150 | task-to-mailbox-to-task communication
(times are in microseconds)
Interrupts

Interrupt handlers can suspend or activate tasks. Only this fact


qualifies RTKernel as "real-time". Interrupt handlers may be written
completely in C. After the handler has served the hardware generating
the interrupt, signals or data may be exchanged freely with tasks
using semaphores or mailboxes. Semaphore or mailbox operations may
then initiate a task switch, if required.
Interrupts of any hardware source may be processed, i.e., hardware
from third-party suppliers not supported by BIOS or DOS can be
supported.
RTKernel comes with three interrupt handlers in source code (for the
keyboard, the serial ports, and network events).
Debugging RTKernel Applications
Since RTKernel is fully integrated into the run-time environment of
the supported compilers, the respective debuggers may be used without
any restrictions for debugging RTKernel applications. Namely, for
Micosoft C, this is CodeView; for Borland C++, both the integrated and
the stand-alone Turbo Debugger are supported. All versions of the
Turbo Debugger can be used (TD, TD286, TD386, and TDRemote).
As a further convenience to the programmer, RTKernel 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 produces corresponding error messages.
In addition to error-checking, RTKernel contains numerous debugging
aids. For example, the current source code position, occupied
resources, or the CPU time requirements of any task can be displayed.
RTKernel's real-time Kernel Tracer is an especially powerful debugging
tool. It can record both kernel and application events.
To further ease debugging, RTKernel (both Debug and Standard Versions)
features a number of routines that can be used to gather information
about tasks. E.g., a list of all tasks may be displayed or the state
of a particular task may be enquired. Also, RTKernel maintains stack
usage statistics. This allows tasks' stack requirements to be
monitored closely. Please refer to file RTKERNEL.H for a complete list
of all these functions.
RTKernel and Windows / DOS-Extenders
RTKernel can execute Windows 3.0/3.1 as a kernel-task. For this
purpose, an RTKernel program is loaded resident. Subsequently, Windows
can be started in Rreal, Standard, or 386-Enhanced Mode. Thereafter,
Windows is treated by RTKernel as a single task. Other tasks within
the RTKernel application continue running under real-time conditions
and can use DOS for file-I/O without restrictions. Windows
applications can communicate with the RTKernel-TSR using software
interrupts or module IPC (inter-process communication, see below).
Thus, complex applications can combine real-time processing and
Windows, with real-time chores handled by RTKernel while the user
interface is implemented under Windows. RTKernel comes with a sample
application that demonstrates this configuration. This example also

shows the exchange of data and signals between Windows and RTKernel,
using software interrupts and and Shared Memory.
Product Contents
RTKernel-C includes module RTKernel as a LIB-file (in Standard and
Debug Versions for all supported compilers), a number of supplemental
modules in source code, and an english User's Manual. (A German
version of the User's Manual is also available upon request.) Apart
from numerous small code examples in the manual, the following demo
programs are delivered in source code:
RTDEMO

Integrated demo program.

COMDEMO

Demo program for serial communications.

IPXDEMO

Demo program for inter-network communications.

RTPRIMES

Prime number generator with approximately 1000 tasks


running in parallel.

RTVDEMO

RTVision demo program with different views for each task.

TSRDEMO
CALLTSR

Resident multitasking program. Communication with TSRDemo


is performed using CallTSR.

WTSRDEMO
WCALLTSR

Resident multitasking program which can run "behind"


Windows. Communication with WTSRDemo is accomplished using
the Windows application WCallTSR.

RTBENCH

Benchmark program
performance.

SEMADEMO

Demo program for using semaphores.

MBDEMO

Demo program for using mailboxes.

MSGDEMO

Demo program for using message-passing.

to

measure

RTKernel's

run-time

RTKernel-C supports Borland/Turbo C++ 1.0, 2.0, 3.0, 3.1, 4.0, BC++
PowerPack, Microsoft C 6.0, 7.0 und 8.0 (Visual C++ 1.0, 1.5), as well
as compatible versions of Microsoft Quick C. Both ANSI C and the
object-oriented C++ can be used with RTKernel. Memory models SMALL,
MEDIUM, COMPACT, LARGE, and HUGE are supported. For Borland C++ 3.0 or
higher, 16-bit Protected Mode is supported. For Borland C++ 4.02
PowerPack or higher, 16-bit Protected Mode is supported. LIB-files are
delivered for all compilers and all memory models listed above.
In addition to RTKernel object code, the following modules are
delivered in complete source code. The interfaces of these modules are
contained in the files *.H.
ITimer
and
Timer

Modules ITimer and Timer allow you to measure any number


of independent time intervals with a resolution of
approximately 0.8 microseconds. A time interval can be up
to 3.7 years long. Furthermore, the frequency of the timer
interrupt can be changed (which usually runs quite slowly
at 18.2 Hertz).

RTKeybrd

RTKeybrd installs its own keyboard interrupt handler, so


that tasks waiting for keyboard input don't consume CPU
time. Using RTKeybrd, a task can be activated immediately
after a key has been pressed. No CPU time is wasted by
keyboard polling.

RTTextIO

Using module RTTextIO, several windows may be defined for


screen output of several, parallel tasks on the screen.
There are no reentrance problems since each task has its
own virtual cursor.

Spooler

The spooler allows output of text files to a printer on a


parallel port in the background.

CPUMoni

CPUMoni monitors the CPU load of an application.


Especially in time-critical applications, this information
is important, since a real-time system must never come
near a CPU load of 100 percent.

RTCom

RTCom implements a complete interface with the serial


ports. You can send and receive data interrupt-driven or
by polling at ports COM1 to COM4. Baud rates of 50 to
115200 bits/second are supported. If a DigiBoard or
Hostess Card is installed, it can also be used. In this
case, up to 36 serial ports can be used simultaneously.
RTCom automatically recognizes 16550-UART chips and uses
its internal buffers.

RTIPX

RTIPX implements a complete, high-level interface to


Novell's IPX protocol. It can be used on workstations with
an IPX driver loaded. Like all other supplemental modules,
RTIPX comes with complete source code. It offers the
following features:
* Data packets for transmission can be up to 64 kBytes in
size.
* Data is never copied by RTIPX (only pointers are
passed/returned). Therefore, very high data transfer
rates can be achieved.
* Each data transfer is acknowledged by the receiver. The
handling of time-outs and retries is completely
transparent to the application. Even with high network
loads and collisions occurring, safe communication is
guaranteed by RTIPX (which is not true for Novell's IPX
protocol).

IPC

IPC
(inter-process
communication)
facilitates
communications among separate DOS programs via DOS's
multiplex-interrupt. Usually, these will be resident
programs to be addressed by an application running in the
foreground. IPC can also be used to communicate between a
Windows application and a resident DOS program.

RTVision

Module RTVision supports using the Turbo Vision toolbox of


Borland C++ together with RTKernel. Different tasks can
use different screen objects.

KillKey

Module KillKey can disable single or multiple keypresses.

In real-time applications, it may be imperative to disable


'hazardous'
keyboard
like
Pause,
Print-Screen,
Ctrl-Alt-Del, Ctrl-Break, etc.
RTKDPMI

This module provides various DPMI functions for Protected


Mode programs. It contains functions for managing
selectors, calling Real Mode programs, Real Mode
callbacks, etc.

The source code of module RTKernel is available optionally. It


contains all C and assembler source files required to completely
rebuild RTKernel. This allows adaptation to your individual
requirements.
RTKernel in Protected Mode
In addition to Real Mode, RTKernel supports 16-bit and 32-bit
Protected Mode. For 16-bit Protected Mode, Borland C++ 3.0, 3.1, 4.0,
or higher is required. 32-bit Protected Mode applications can be
created using Borland BC++ 4.02 PowerPack. On 80286 or higher
processors, the Protected Mode applications can utilize up to
16 megabytes of physical memory and up to 120 megabytes of virtual
memory; 32-bit Protected Mode programs can address up to 4 Gigabytes.
For use with Borland C++ 3.0 and higher, a 16-bit Borland DOS Extender
is delivered with RTKernel. Borland's DOS Extenders are free of
run-time royalties, which means that your applications containing the
DOS Extender can be distributed to third parties free of licensing
fees from On Time Marketing or Borland.
Demo program RTPrimes (RTPRIME.EXE) uses the PowerPack's 16-bit DOS
Extender. If enough Extended or XMS memory is available, it will
create and run up to approx. 6500 tasks simultaneously.
Demo Programs
This Demo Disk contains four executable programs. Please note that
these programs are not compatible with other multitasking systems
(e.g., DesqView or PC-MOS). In principle, RTKernel applications can be
executed on Novell Lite network servers; however, the demo programs
are not configured for this environment in order to keep them simple.
Short descriptions of the demo programs follow.
Program RTDemo
Program RTDemo consists of eight tasks. It shows how several tasks can
run in parallel within a program, virtually without restrictions. File
RTDEMO.C contains detailed information about the program. RTDemo uses
RTKernel's Debug Version.
RTDemo shows, for example:
*

parallel screen access of several tasks

parallel DOS calls of several tasks

parallel DOS applications (FORMAT.COM, COMMAND.COM,


RTDEMO.EXE) being executed by different tasks

and

background printing

interrupt-driven keyboard input

interrupt-driven reception of data at a serial port

measurement and display of CPU load

modification of the timer interrupt rate

cyclic tasks (tasks running in a fixed time frame)

usage of CPU time by other tasks during disk-I/O idle times

Kernel Tracer

Program COMDemo
This program demonstrates the processing of interrupts from the serial
ports. It requires two computers connected by a serial cable (a
minimal configuration with leads Receive, Send, and Ground connected
is sufficient).
After the program has been started on both computers, arbitrary lines
of text may be entered and then transmitted to the other computer
using the <Return>-key. If an empty line is entered, the last line
will be re-transmitted.
Both computers can independently and asynchronously transmit data to
the other computer. The program is terminated by entering the line
'EXIT'.
Program IPXDemo
This program demonstrates the transmission of data using a Novell
Network. To use it, at least two workstations in a Novell LAN (e.g.,
Novell NetWare or Novell NetWare Lite) are required. At the
workstations, at least Novell's IPX driver must be loaded. A NetWare
shell is not required. Also, NetWare Users need not have logged in to
the network. Addtional information is supplied by program IPXDemo when
it is executed. More detail concerning the operation of this program
is given in the source file IPXDEMO.C.
Program RTPrimes
RTPrimes implements a quite slow and "memory-hungry" prime number
generator. What's interesting about it is the algorithm used: it
computes many prime numbers in parallel. The program runs in Protected
Mode and creates - depending on available memory - up to about 6500
tasks. RTPrimes also shows how to use reentrant code (nearly all of
the program's tasks execute the same code). For details, please refer
to the source file RTPRIMES.C.
RTKernel is developed, distributed and supported by:

On Time Informatik GmbH


Hofweg 49
22085 Hamburg
GERMANY
Phone +49 - 40 - 227 94 05
Fax +49 - 40 - 227 92 63
http://www.on-time.com
info@on-time.de
In North America (USA, Canada, and Mexico), RTKernel is distributed
and supported by:
On Time Software
88 Christian Avenue
Setauket, NY 11733
USA
Phone (888) 667-8200
Phone (631) 689-6654
Fax (631) 689-1172
http://www.on-time.com
info@on-time.com
If you require additional information about RTKernel, please do not
hesitate to contact us. We look forward to serving you.

Das könnte Ihnen auch gefallen