Dec 092017
Multitasking Source for Turbo Pascal, Very Good.

Full Description of File

CPMULTI Multitasking Toolkit v 2.5 This
is an upgrade of a German toolkit by
Christian Philipps. The latest German
version, 2.20, is still shareware.
Version 2.5 is now in English. This is
a full-featured toolkit implementing
preemptive multitasking, thus allowing
programmers to write multithreaded
applications under DOS.

File CMP25D.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Multitasking Source for Turbo Pascal, Very Good.
File Name File Size Zip Size Zip Type
BEEPER.EXE 13664 8431 deflated
BEEPER.PAS 3600 1315 deflated
CALLDOS.EXE 19264 11223 deflated
CALLDOS.PAS 4546 1522 deflated
CPMSWITC.INC 266 180 deflated
FILE_ID.DIZ 340 229 deflated
FINDER.EXE 24592 13447 deflated
FINDER.PAS 11342 3516 deflated
GLASSTTY.EXE 27248 14716 deflated
GLASSTTY.INC 11178 2574 deflated
GLASSTTY.PAS 3579 1205 deflated
KBTEST.EXE 15856 9753 deflated
KBTEST.PAS 1100 580 deflated
LSTTEST.EXE 21616 12091 deflated
LSTTEST.PAS 1169 540 deflated
MTEST.EXE 14720 8962 deflated
MTEST.PAS 3477 1119 deflated
PHILO.EXE 15152 8987 deflated
PHILO.PAS 8828 2453 deflated
PRO_CON.EXE 15024 8959 deflated
PRO_CON.PAS 14774 4072 deflated
QUETEST.EXE 16384 9734 deflated
QUETEST.PAS 2679 987 deflated
READ-ME.TXT 16718 5877 deflated
RSCTEST.EXE 12624 7984 deflated
RSCTEST.PAS 2168 826 deflated
SPEEDUP.EXE 12672 7995 deflated
SPEEDUP.PAS 2415 987 deflated
TASKWIN.EXE 13552 8427 deflated
TASKWIN.PAS 3196 1106 deflated

Download File CMP25D.ZIP Here

Contents of the READ-ME.TXT file

Product Information: Multitasking Toolkit V2.5 for Turbo Pascal

1. Contents of this file

This file contains the following information about the Multitasking Toolkit

1. Contents of this file
2. Overview
3. Summary of features
4. List of routines available
5. The demo programs (executables and source)
6. Questions and answers

Please note: This demo diskette may be freely copied and distributed in
electronic form (including uploading to "bulletin boards" or other online
services) so long as it is not altered in any way. In addition, this
informational text file may be copied and distributed in printed form so long
as it is not altered.

2. Overview

The Multitasking Toolkit has been around in several versions since 1988. It
is used by software houses, major accounts and universities all over the
world. There are installations today in Germany, the USA, Canada, Austria,
Switzerland, Hungary, the CSFR, Brazil and the Netherlands.

The Multitasking Toolkit consists of several Turbo Pascal units which
provide the programmer with everything needed to execute any number of
Pascal procedures in parallel (in a multi-threaded application). The
available computing power is divided among all competing tasks by a dynamic
preemptive scheduler. By assigning a task to one of nine priority levels,
the programmer may prioritize the processes according to their role in the

The Multitasking Toolkit allows the application to change the minimum size
of a time-slice (>= 5 milliseconds) and also the range in which the
scheduler may dynamically adjust timeslices. In this way, high-priority
tasks can be made to react very quickly to external events, so that the
toolkit is suited very well to developing device control and data
communications applications.

Any multitasking application needs a way to synchronize access to resources
and to exchange data between processes. The Multitasking Toolkit offers
semaphores, resources, message-passing, pipes and finally, events and
timers. A basic set of serial comm functions which interface to the
multitasking toolkit and a character oriented print spooler are provided
and smoothly integrated into the package. The spooler is fully compatible
with the PRINTER unit and may therefore be used as a plug-in replacement.

The Multitasking Toolkit is aware of the "DOS reentrance" problem and
automatically synchronizes access to DOS. Therefore tasks may concurrently
execute DOS functions without any precautions being taken by the

programmer. In addition, one external program (such as COMMAND.COM) may be
executed in parallel to the Turbo Pascal application. This enables the
programmer to easily develop a multitasking background application which is
able to control the foreground task if necessary (inhibit keyboard I/O,
stuff keys into the keyboard buffer, suspend the foreground process, etc.).
Tasks may be kept waiting for a hot-key combination to be pressed (like a
pseudo-TSR). The hot-key task will be activated even if the hot-key is
pressed in the foreground application.

A separate unit is included in the Multitasking Toolkit to transparently
synchronize access to the Turbo Pascal heap. This makes writing multi-
tasking applications very easy, especially when using the object-oriented
language enhancements, because there are no special precautions needed in
order to prevent heap corruption.

3. Summary of features


- Runs on any PC, XT, AT, PS/2 and 100% compatible systems
- Compatible with DOS 2.11 and above, as well as DR DOS 3.41 and above
- Supports Turbo Pascal 5.0, 5.5, 6.0, 7.0 and Borland Pascal 7.0
(real mode)
- No runtime-license payments
- Full source code available
- Printed documentation
- Very robust implementation


- Unlimited number of tasks
- 9 priority levels
- Priorities may be changed at runtime
- Compatible to MS-Windows DOS-box
- Code sharing
- Preemptive scheduler
- Programmable timeslice (>= 5 ms)
- Dynamic adjustment of timeslices
- Time slicing may be switched off for full application control
- Safe to do concurrent DOS I/O (no task switch while any task is
executing OS code)
- Optional "exclusive mode" on a per-task basis (task running in this
mode is never preempted)

Task Synchronization and IPC:

- Semaphores
- Message-passing
- "Named pipes" (Turbo Pascal TEXT-file driver)
- Resources
- Programmable timer
- Easy-to-use event handling

(continued next page)

What else?

- Character-oriented print spooler (LST-device)
- Interrupt-driven serial I/O-handling
- Pipe interface to serial I/O-unit (read/write to the port via
Read/Write, etc.)
- Extended keycodes (character, scan-code, shift-status)
- Full keyboard control
- Run one external DOS-program as a sub-task
- Hot-key activation of tasks

4. List of routines available

This is a list of all the procedures and functions in the API of the
Multitasking Toolkit:

Task management routines

procedure ChangePri(Task:TaskNoType; Pri:Priority);
function CreateTask(TaskPointer:TaskType; UserData:Pointer;
procedure Kill(Task:TaskNoType);
function ReadySuspended(Task:TaskNoType) : Boolean;
procedure SetPri(Pri:Priority);
procedure Sleep(Ticks:LongInt);
procedure SpeedUp(Factor:Word);
function Suspend(Task:TaskNoType) : Boolean;
procedure Terminate;
procedure DoShutdown;
procedure TimeSlice(Slice, DynQ:Byte);
procedure Sched;

Misc. synchronization routines

procedure BindCPU;
function EnterExclusive : Boolean;
procedure LeaveExclusive;
procedure ReleaseCPU;


function CreateSem(var SemPtr:Pointer) : SemReturn;
function RemoveSem(var SemPtr:Pointer) : SemReturn;
function RemoveSemKill(var SemPtr:Pointer) : SemReturn;
procedure SemClear(SemPtr:Pointer);
procedure SemClearWait(SemPtr:Pointer);
function SemCut(SemPtr:Pointer;Task:TaskNoType) : Boolean;
procedure SemDiag(SemPtr:Pointer; Txt:String);
function SemGetSignals(SemPtr:Pointer) : Word;
procedure SemPaste(SemPtr:Pointer; Task:TaskNoType);
procedure SemSet(SemPtr:Pointer; Count:Word);
procedure SemSignal(SemPtr:Pointer);
function SemSoWaiting(SemPtr:Pointer) : Boolean;
function SemWaiting(SemPtr:Pointer) : Boolean;
procedure SemWait(SemPtr:Pointer);

Inter-process communication

function Receive(FromTask:TaskNoType; MsgBuff:Pointer;
WaitFlag:WaitFlagType) : TaskReturn;
function ReceivedFrom : TaskNoType;
function Send(ToTask:TaskNoType; Msg:Pointer; MsgSize:Word;
WaitFlag:WaitFlagType) : TaskReturn;


function MemoryEventWait(MemPtr:Pointer) : Boolean;
function PortEventWait(EPortNo:Word; var ENewValue:Byte) : Boolean;


function CancelTimer(MemPtr:Pointer) : Boolean;
function CancelWatchdog(TWatchdog:WatchdogType) : Boolean;
function QueueTimer(MemPtr:Pointer; Counter:Word) : Boolean;
function QueueWatchdog(TWatchdog:WatchdogType;

Information and debugging

function GetPID : TaskNoType;
function GetPri : Priority;
function GetTaskState(Task:TaskNoType) : TaskStatus;
function GetTimBusy : BPtr;
procedure DumpTaskTable;
function Seconds(Sec:Word) : LongInt;


function GrantRsc(RscPtr:Pointer) : RscReturn;
function ReleaseRsc(RscPtr:Pointer) : RscReturn;
function CreateRsc(var RscPtr:Pointer) : RscReturn;
function RemoveRsc(RscPtr:Pointer) : RscReturn;
function RemoveRscKill(RscPtr:Pointer) : RscReturn;
function RequestRsc(RscPtr:Pointer, WaitFlag:WaitFlagType) : RscReturn;


function AssignPipe(var PT:Text; PName:PipeNameType;
PSize:Word; RequestSize:Byte;
AlwaysBlock:WaitFlagType) : Boolean;
function ExistPipe(PName:PipeNameType) : Boolean;
function ReadPipeDirect(var PT:Text; var Buf; Count:Word) : Boolean;
function WritePipeDirect(var PT:Text; var Buf; Count:Word) : Boolean;

Print spooler

procedure CancelPrint;
function PrintBufferAvail : Word;
function PrintBufferFilled : Word;
function PrinterReady : Boolean;
procedure RestartSpooler(Size:Word);
function SpoolerBusy : Boolean;

Serial communications

function AuxSendTimeout : Boolean;
procedure CloseAux(Reading:TaskNoType);
procedure OpenAux(ComPort:ComType; BaudRate:BaudType;
Stop:StopBitsType; BufSize:Word);

DOS tasks, popups, and keyboard handling

procedure CallDos(Path, CmdLin:String);
function DeregisterPopUp(Handle:Byte) : Boolean;
procedure DisablePopUps;
procedure EnablePopUps;
function GetKey : LongInt;
function LongIntToHex(Value:LongInt) : LongHex;
procedure KbdAppend(Task:TaskNoType);
function KbdDisable(Task:TaskNoType) : Boolean;
procedure StateToTurbo;

5. The demo programs

All of these demo programs can be found on the demo diskette both in
executable form and with full Pascal source code.


This program demonstrates some of the most basic features of the
CPMulti kernel, including semaphores, code sharing, and priority


This program demonstrates the capabilities of MTPopup by executing
COMMAND.COM as a task, giving a DOS shell to the user. Pressing F10
will show the task status window.


This program searches multiple disks for occurrences of the specified
filenames. For each search request, a separate process is started.


This is a bare-bones terminal emulator which illustrates the use of
the CommPipe unit.


This demo program shows the keyboard-handling capabilities of the
MTPopup unit. For each key the user presses, all available information
is displayed. Pressing Escape will end the program.


This demo program uses the MTPrint unit to implement a simple print


This illustrates the most basic use of the message-passing functions
in the CPMulti kernel.


This is a solution for the classic "Dining Philosophers" problem,
which deals with resource contention.


This illustrates keyboard handling (XON, XOFF) as an instance of the
producer-consumer problem.


This demonstrates the Queue unit; it allows the user to enter a list
of strings into a queue and then delete them selectively.


This program shows the basic use of the resource functions in the
CPMulti kernel.


This program is an illustration of the SpeedUp function.


This program demonstrates simple code sharing between concurrent tasks.

6. Questions and Answers

Why program under DOS anyway, as opposed to a multitasking operating

For one thing, the operating system overhead is less. Some vendors
report that the DOS version of a program can run up to ten times
faster than the Windows version on the same machine. In many
applications, speed is critically important.

For another thing, programming in DOS does not require dealing with
a complex API such as that of Windows. Programmers who are unfamiliar
with an event-driven message-passing paradigm often find it difficult
to program for Windows or OS/2.

Also, it should be noted that Windows 3.1 is a cooperative (not pre-
emptive) multitasking environment. This disadvantage does not exist
with the toolkit. To be fair, Windows NT and OS/2 do not have this
problem either; but they are still less common than Windows.

What versions of Turbo Pascal are supported?

Versions 5.0, 5.5, 6.0, and 7.0.

What versions of DOS are supported?

PC DOS or MS DOS, versions 2.1 or later; DR DOS, versions 3.41
or later. The toolkit has not been tested with Novell DOS 7; it is
conceivable that there might be conflicts with the intrinsic multi-
tasking features of the new operating system.

What are the minimum hardware requirements?

CPMULTI should run on a machine with the 80286 processor or any later
chip in the family (386, 486, Pentium). There are no specific minimum
memory requirements.

Is there support for object-oriented programming (OOP)?

CPMULTI applications may use OOP freely, of course. However, there
is currently no object-oriented version of the application programming
interface; e.g., there is no "Semaphore" object with its own methods,
constructor, and destructor.

Does the toolkit support Turbo Vision?

Programs using CPMULTI may make free use of Turbo Vision (provided the
GrabHeap unit has been included); but there is no explicit interaction
between TV and CPMULTI.

Are there royalties required for use of the units?

No! The toolkit may be used royalty-free, provided, of course, that
the individual units comprising CPMULTI are not distributed as units
or as source, but only as part of the linked .EXE file.

Does the toolkit support protected mode (DPMI) programming under
Borland Pascal 7.0?

Protected mode is not yet supported. Early experiments have
shown, however that it can be done with major changes in the
assembly language modules of the kernel. Possible releases
of the toolkit may contain protecte mode support.

Is the toolkit useful in Windows programming?

There is no support for Microsoft Windows nor any interaction with
it. However, applications using CPMULTI will run in a DOS window
just as they will run under DOS.

What about technical support?

In the past, this has been provided by the author, who may continue
to do so at his own discretion. In no event will the distributor be
responsible for technical support.

How can I order CPMULTI?

See the final section below, ORDERING INFORMATION.

How can I contact the author?

The author may be reached at the following address:

Christian Philipps
Duesseldorfer Str. 316
D-47447 Moers

Phone: 0049-2841-35932
Internet: [email protected]
CompuServe: [100012,1227]


CPMULTI may be ordered from the distributor, Hypermetrics, at the following

PO Box 9700
Suite 363
Austin, TX 78766-9700

Phone: (512) 244-7833 (voice mail, fax)
Internet: [email protected]
CompuServe: [71540,3514]

Pricing as of January 1, 1994 is as follows:

$ 99 for object code only;
$299 for the version with full source code.

Add $5 for shipping and handling.
Residents of Texas should also add 8% for state sales tax.

Payment may be made by check or money order. Purchase orders will be accepted
from corporate or government entities. Note that credit cards cannot be

The standard medium is a 3.5" diskette; users requiring 5.25" diskettes should
request that size.

Call for site license information or upgrades for registered users of the
older shareware version.

 December 9, 2017  Add comments

Leave a Reply