NAME task.intro - introduction to the coroutine library and man pages SYNOPSIS #include <task.h> class object { ... }; class sched: public object { ... }; class task: public sched { ... }; class timer: public sched { ... }; class Interrupt_handler : public object { ... }; class qhead: public object { ... }; class qtail: public object { ... }; struct histogram { ... }; class randint { ... }; class urand: public randint { ... }; class erand : public randint { ... }; DESCRIPTION These man pages provide the reference material needed to understand the details of the individual functions and classes which make up the task, or coroutine, library. There is a separate tutorial which provides an overview and some examples. The task library was designed for use in simulation pro- grams, and was originally written in C at AT&T Bell Labora- tories. It was adapted for use with C++, but still shows its C heritage in places. The task library provides a way to write programs with mul- tiple threads of control without incurring the overhead of a separate Unix process for each thread. It is particularly useful for simulations where each object in the simulation has an independent execution thread. When there are hun- dreds or thousands of objects, it is impossible to have a separate Unix process for each one. This library allows the entire simulation to run as a single Unix process, while simulating separate processes and the passage of time. The task library provides for non-preemptive task schedul- ing. This greatly simplifies program design, because no extra synchronization is required. Each task runs until it gives up control explicitly (as by executing a wait opera- tion or terminating), or implicitly (as by requesting a ser- vice which cannot be provided immediately). Tasks may thus be suspended and resumed independently. Task Classes These classes are described in the man page task(3C++). object The base class for all task system classes. The system comprises lists and queues of various kinds, and every- thing on a list or queue is derived from class object. sched Provides the basic scheduling functionality. No object of type sched may be created, but all tasks and timers are derived from this class. Thus, there is no ``scheduler'' as such, but rather all task objects in the system cooperate in the scheduling process by means of the member functions and data of this class. timer A very simple form of task, which provides only the passage of time. A task may initiate a timer, for example, and wait for it to expire. task The base class for all actual user tasks. No object of this type may be created. A user task object must be of a type derived immediately from class task. The constructor for the user task type is the main program for an individual task. Interrupt Class Class Interrupt_handler provides an interface for dealing with external events via Unix signals. This class is described in the man page interrupt(3C++). Queue Classes Classes qhead and qtail together make up a queue (a first-in first-out list). Anything derived from class object may be placed on a queue. These classes are described in the man page queue(3C++). Statistical Classes These classes provide simulation and data gathering aids. They are described in the man page tasksim(3C++). histogram Allows data gathering in a histogram. randint Provides uniformly-distributed random values in the range 0 to maxint. urand Provides uniformly-distributed random values in a user-specified range. erand Provides exponentially-distributed random numbers around a specified mean. NOTE As of the date of this release, the coroutine library will not be supported beyond the current version. SEE ALSO interrupt(3C++), queue(3C++), task(3C++), tasksim(3C++), and Chapter 2, "The Coroutine Library," of the C++ Library Reference.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |